Commit Graph

41 Commits

Author SHA1 Message Date
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer 16bb07021f RuboCop: Style/AndOr, Style/Not
auto-corrected

Change-Id: I410fc4618aa834c62fccf8370866e115b437386a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278802
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-19 22:22:35 +00:00
Cody Cutrer 8d4fee2d25 RuboCop: Style/RedundantAssignment
[skip-stages=Flakey]

auto-corrected

Change-Id: I73517db1000afa49b81fdd4f40d610faa760e6ff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277967
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-11 17:39:20 +00:00
Cody Cutrer 58d528037e RuboCop: Lint/AssignmentInCondition
[skip-stages=Flakey]

(manual)

Change-Id: I855b13a7888f4926df42fe6306cc248e611efdf6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274712
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-29 03:38:39 +00:00
Cody Cutrer c65d57737a RuboCop: Layout lib
Change-Id: I0655d9a9d750f2debd6378b03d8ddc1403ebc31b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274158
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-22 20:01:52 +00:00
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:49:50 +00:00
Cody Cutrer c5227d3f1b shackles was renamed to guardrail
closes FOO-989, FOO-990

Change-Id: I49dfa130cb74c34dd0eb25952790176ae4951058
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249365
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-06 19:23:08 +00:00
Cody Cutrer 6b6cb86ca5 limit lots more stuff to non_shadow root accounts
Change-Id: I99f8edb00d912b31ca29cba32f724ac33330e4ab
Reviewed-on: https://gerrit.instructure.com/194426
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
2019-05-20 22:49:36 +00:00
Cody Cutrer ce9fcf595f run counts reports in parallel
refs CORE-1505

also, don't build the overview report anymore (which requires summing up
all of the parts)

Change-Id: Icb4c317e65237cb4ea9a800d7742f36ebac79022
Reviewed-on: https://gerrit.instructure.com/154342
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-06-21 14:44:22 +00:00
Landon Wilkins 966f0c6ffb da licença part 33
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: Ifeefd2dff9d8d03383120b340a3fc2c9e0534a5b
Reviewed-on: https://gerrit.instructure.com/110059
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 22:00:04 +00:00
Cody Cutrer e835285ea0 bump rails 4.2 for security fixes
and fix something that became deprecated

Change-Id: Ib335f248add8dc4644b41c56639274a0b3858a66
Reviewed-on: https://gerrit.instructure.com/87533
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-08-11 23:12:43 +00:00
James Williams 20cdfd24b1 rails4.2: Fixnum#ago is deprecated
e.g. use .seconds.ago instead of .ago

refs #CNVS-26056

Change-Id: I5af8541116623a8fc8b49682b0829a065aba59c8
Reviewed-on: https://gerrit.instructure.com/69339
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-12-29 21:14:11 +00:00
Cody Cutrer 34b8f46ba5 several qualified names fixes in raw SQL
refs CNVS-21900

Change-Id: I54afb7f5b35109f4cc78ab2f285e5bc9cb01190f
Reviewed-on: https://gerrit.instructure.com/67243
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-11-18 22:01:23 +00:00
Cody Cutrer 9e353116ce quote table names in joins
refs CNVS-21900

Change-Id: I260c8dbae3c4abd7fe436f2051e1cc852ef1675f
Reviewed-on: https://gerrit.instructure.com/58554
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-07-16 16:35:31 +00:00
Strand McCutchen 1a24af8e53 fix Lint/StringConversionInInterpolation issue
Change-Id: Ibea00b023aa91e4f4a627161fbe87dbb54d22daf
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52884
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-27 20:53:25 +00:00
Ethan Vizitei 1004e66540 get sentry into canvas
closes CNVS-6016

No more error reports!  (soon)

this commit builds up sentry integration through the new
Canvas::Errors module, along with other things that need
to happen on every exception.  ErrorReports
should now get pushed towards just being used for representing
a complaint a user filed via the get help form.

I fixed about half the things that got linted as well
while I was in here, but because this touches to much
I fear divergence from tackling too many (I think we
can safely say it's "better than we found it")

I left a lot of the infrastructure for error reports in place
until other commits for plugins can be merged

TEST PLAN:
 1) setup your raven.yml config file with the dsn for our
  sentry install
 2) force an error to happen in a request response cycle.
 3) see the error in sentry
 4) force an error to happen in a job
 5) see the error in sentry
 6) statsd increments shoudl still fire
 7) for the moment, an error report should still get created.

Change-Id: I5a9dc7214598f8d5083451fd15f0423f8f939034
Reviewed-on: https://gerrit.instructure.com/51621
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-13 22:26:15 +00:00
Jacob Fugal e08c236424 be liberal in checked account namespace
fixes CNVS-17259

some older attachments will have the "accounts_123" style namespace
(local account id), but most newer ones will have the
"accounts_4560000000000123" style namespace (global account id). match
against either when counting attachments for account statistics

test-plan:
 - create an account with a course in it (account statistics don't
   calculate for accounts with zero courses)

 - upload two files in that course

 - in the console, change one attachment's namespace to have the
   account's local ID instead of global ID:
     attachment = Attachment.where(
       namespace: "account_#{account.global_id}").
       first
     attachment.namespace = "account_#{account.local_id}"
     attachment.save!

 - in the console, trigger a run of the statistics aggregator:
     Reporting::CountsReport.process

 - view the account statistics for the account at
   /accounts/:id/statistics; should include both files in the statistics
   (e.g. have 2 files reported, and file size equal to the sum of the
   files sizes)

Change-Id: Ifec4ca47faab89b47244b22f26929cb59e69df92
Reviewed-on: https://gerrit.instructure.com/45636
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-12-12 23:13:20 +00:00
Brian Palmer 43ceac3dd7 insert CountsReport errors on the default shard
fixes CNVS-6375

Change-Id: I0771b55ead6fa04d8fa19cfd58addce36758863c
Reviewed-on: https://gerrit.instructure.com/37332
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-07-08 14:47:00 +00:00
Cody Cutrer 8a4a14ea29 don't stop CountsReport when one job fails
fixes CNVS-6375

Change-Id: I6e0631f73f8b47dc3c7d825d9f9f84f42225a33d
Reviewed-on: https://gerrit.instructure.com/36484
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-16 18:58:14 +00:00
Cody Cutrer db181537dc skip intermediate join table for counts report query
Change-Id: I60350b953815a53d287797c12ed2fe2886132e88
Reviewed-on: https://gerrit.instructure.com/30295
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Hubert depesz Lubaczewski <hlubaczewski@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-19 21:53:15 +00:00
Brian Palmer d1486b6930 remove last_activity from CountsReport
This data point is difficult to get with the new page views
infrastructure, and isn't displayed anywhere anyway.

fixes CNVS-6731

test plan:
* with cassandra page views enabled, open a rails console and run
  Reporting::CountsReport.process
* once that completes, go to /accounts/X/statistics and verify that the
  stats have been updated (there is a generated timestamp at the top)

Change-Id: I7f1144cd6dab9b68478a79e3f7f82bc6d8feb0b3
Reviewed-on: https://gerrit.instructure.com/22046
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-07-05 21:41:31 +00:00
Cody Cutrer 6e9c843b3d switch to Shackles gem
extracted out of canvas-lms

refs CNVS-4713

test plan:
 * actions that use a slave should still work (dashboard render)
 * you should be able to switch envs and users in console

Change-Id: I07dda8057cf94383bc4579f1ef6b5a4b3ffc20b5
Reviewed-on: https://gerrit.instructure.com/19287
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-04-17 16:25:06 +00:00
Cody Cutrer 5ffbcbeb05 arel-ify lib
excluding api_find, which needs more work

refs CNVS-4706

Change-Id: I013d0660ff2b8dbe2abf6a5c973bd1203f432f99
Reviewed-on: https://gerrit.instructure.com/18921
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 19:12:22 +00:00
Jacob Fugal 4a236e32bd change tracking of active teachers/students/users
...in the CountReport to only users with a pseudonym that's been
accessed in the last 30 days. fixes #11381

Change-Id: Ic4c10b1bd49bc9f10e5d4ef20a7ea2bd78ab27b9
Reviewed-on: https://gerrit.instructure.com/14780
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-29 12:20:36 -06:00
Cody Cutrer 7b8dd548d3 a few more things to skip for deleted root accounts refs #6891
Change-Id: Id56c0f9a157734483fad29ffd95b9ea146ff1002
Reviewed-on: https://gerrit.instructure.com/13060
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-08-21 13:49:23 -06:00
Cody Cutrer 8e4b59a3ba switch back to the master to save results of CountsReport
test plan:
 * run CountsReport with a slave environment that's not writeable

Change-Id: Ie99db198a42a505401bde711c674349763b79bad
Reviewed-on: https://gerrit.instructure.com/10721
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-05-14 12:51:09 -06:00
Brian Palmer 671f04606f remove page views from the counts report
This will get added back in once page views are moved out of the
database.

test plan: visit an account statistics page, the two lines of page view
counts in last week/month will be gone. The CountsReport periodic job
should now not do the page view rollup queries.

Change-Id: Icb947a88ff6644d600a31593ff07050f964b8580
Reviewed-on: https://gerrit.instructure.com/10640
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-05-09 13:31:29 -06:00
Cody Cutrer 2cb3d39f56 use a slave db if available for CountsReport
test plan:
 * run Reporting::CountsReport.process; it should work
 * add a slave db configuration as a child of the current
   environment to database.yml; re-run the CountsReport

Change-Id: Iba08d6697cf0e864ecbc3a2829fcd7a134267bec
Reviewed-on: https://gerrit.instructure.com/10100
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-04-19 12:33:20 -06:00
Cody Cutrer df56b0dd7d update with_each_shard stub
Change-Id: I8737b2735ac1564e1fa6ec8b0ca0055e5039bb6a
Reviewed-on: https://gerrit.instructure.com/10072
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-16 15:01:56 -06:00
Simon Williams 874b5489c1 student view; closes #6995
allows course admins to view the course from a student perspective. this is
accessible from a button on the course/settings page. They should be able to
interact with the course as a student would, including submitting homework and
quizzes. Right now there is one student view student per course, so if the
course has multiple administrators, they will all share the same student view
student.

There are a few things that won't work in student view the way the
would for a normal student, most notably access to conversations is disabled.
Additionally, any publicly visible action that the teacher takes while in
student view will still be publicly visible -- for example if the teacher posts
a discussion topic/reply as the student view student, it will be visible to the
whole class.

test-plan:
- (the following should be tried both as a full teacher and as
  a section-limited course admin)
- set up a few assignments, quizzes, discussions, and module progressions in
  a course.
- enter student view from the coures settings page.
- work through the things you set up above.
- leave student view from the upper right corner of the page.
- as a teacher you should be able to grade the fake student so that they can
  continue to progress.
- the student should not show up in the course users list
- the student should not show up at the account level at all:
  * total user list
  * statistics

Change-Id: I886a4663777f3ef2bdae594349ff6da6981e14ed
Reviewed-on: https://gerrit.instructure.com/9484
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-04-03 14:11:07 -06:00
Cody Cutrer d7e3d5e842 refactor ReportSnapshot refs #7721
basically for detailed reports, have a row per account, instead of
stuffing everything into one massive hash with every account

test plan:
 * ensure that the account statistics page still works
 * ensure that the statistics update when the delayed job runs

Change-Id: I2d4c9ff5a86c8df6d82097aa4f0203a0f55ddb2d
Reviewed-on: https://gerrit.instructure.com/9565
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2012-03-30 09:17:43 -06:00
Cody Cutrer de92da47b0 remove the account.root_account || account idiom
just make Account#root_account return self if it is a root account

test plan:
 * run existing specs

Change-Id: Iff3f621bb722e0f5e90659c4b711d48d8d3c510f
Reviewed-on: https://gerrit.instructure.com/7700
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-01-03 11:47:33 -07:00
Cody Cutrer e280a309d2 don't use presence/absence of root_account(_id) to determine if an account is a root account
in preparation for having Account#root_account return self if it is a root account

also remove some unused named scopes

test plan:
 * run specs

Change-Id: I8c78c45f0d2f6002021bc2bba594de8bcbaa086b
Reviewed-on: https://gerrit.instructure.com/7698
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-01-03 11:47:22 -07:00
Brian Palmer 92feb2bcdb replace ActiveRecord::Base calls with subclass calls where it makes sense
This was already a small issue if the job queue was on a different
database driver than the main database, and it'll become more important
as more AR connections are introduced.

Change-Id: I204becadd32bb935df096e8c937a04bb6962f0b2
Reviewed-on: https://gerrit.instructure.com/4601
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-18 13:56:08 -06:00
Brian Palmer 0fbc37226c counts report error when new external status is added, fixes #4730
also limit the job to one attempt

Change-Id: I65bad8ae6e7aa79e4916d4f5f03ef67d2dc683de
Reviewed-on: https://gerrit.instructure.com/3980
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-06-02 09:29:01 -06:00
Cody Cutrer 8f4e0687cf use named scope to avoid postgres warning
Change-Id: I9ef84d815ddf059ae0244977af250eb39d1b6c85
Reviewed-on: https://gerrit.instructure.com/3486
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-05-04 16:59:24 -06:00
Jon Jensen 471267deb9 rework some mysql-specific stuff, closes #4090
Change-Id: I6791f124aae5caf2c5a3d5cd2b36dce60657d7ca
Reviewed-on: https://gerrit.instructure.com/2843
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-03-28 12:44:08 -06:00
Jon Jensen 4ea607cea4 postgres support and misc bugfixes, fixes #3574, #3943
Change-Id: I16aa188175a588b02dd6460baa83daae805aec9f
Reviewed-on: https://gerrit.instructure.com/2474
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-03-11 18:01:02 -07:00
JT Olds c1f180bf7e Bug fix for last minute features.
Change-Id: Ie04d4756d41b37902ef30d161f1f0ac9436ac2b3
Reviewed-on: https://gerrit.instructure.com/2094
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
2011-02-01 10:16:42 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00