Commit Graph

64 Commits

Author SHA1 Message Date
Cody Cutrer 636f7f3034 fix DueDateCacher quoting table names
fixes CNVS-24265

Change-Id: I7e43fb24d994052660cf7835b73200418c51c1bf
Reviewed-on: https://gerrit.instructure.com/65760
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-10-27 01:59:40 +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
Jacob Fugal 13005bcd84 optimize due date cacher trivial case
Change-Id: I238bd25f5083832abb5656580855ba8a64b1a54b
Reviewed-on: https://gerrit.instructure.com/27092
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-03-24 16:13:20 +00:00
Cody Cutrer 3cb81b8bb5 filter assignments in addition to submissions for DueDateCacher
helps postgres avoid a temp table

Change-Id: I33ffd1f3d35523eb350a8adff1a54eff799c95da
Reviewed-on: https://gerrit.instructure.com/30297
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-20 18:30:33 +00:00
Cody Cutrer bded0a7a2a don't unnecesarily dirty rows
this data actually changes rarely, so don't force the row to be written
if it didn't change

Change-Id: I7876ab5488f8b0d810f032f20bc5a60c06447efd
Reviewed-on: https://gerrit.instructure.com/28995
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-01-22 17:40:52 +00:00
James Williams 4b5ef5d093 fix active record update_all with joins for rails 3
also update due_date_cacher sql to not break in rails 3
when the joins are applied in reverse order

Change-Id: I9638f0483cc7c995773b512e0f9bfe1fdc3aa682
Reviewed-on: https://gerrit.instructure.com/28173
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-01-09 16:43:11 +00:00
James Williams 70fa975524 use self.primary_key and self.table_name
in order to avoid rails 3 deprecation warnings

Change-Id: If4c6ece9496e1161718770420384003de23f0421
Reviewed-on: https://gerrit.instructure.com/28206
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-01-09 12:34:12 +00:00
Nick Cloward 3ca2c595e5 analytics showing submissions were submitted if teacher give a 0
fixes: CNVS-1601

Since submissions were not created for students who did not submit an
assignment the analytics were showing them as missing even if they were not due
yet. Regardless what the score was.  The fix changed the DueDateCacher to create
submissions for students with overridden due dates.  This will cache the due date
so analyitics can correctly calculate the graph data.  The analytics will search
for a submission,  if it finds one it will use the cached due date for
calculations,  if not it uses the assignments date due assuming there are not any
dates that are overridden.

Also reference g/23800.

Test Case:
  Setup: Create a Course with an assignment and an enrollment.

  - Without the student submitting the assignment. Grade the assignment for the
    student.
  - Open analytics for the course and the Assignments graph should not show any
    submissions for that assignment.
  - Create a due date override.
  - A submission should be created to cache the due date and the graph should
    not show any submissions for that assignment.

Change-Id: Icdae246d9c9913c8a163505d14b86f1300c809de
Reviewed-on: https://gerrit.instructure.com/25352
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-11-19 20:36:33 +00:00
Jeremy Stanley 5773e05c3c avoid excessive update-cached-due-date callbacks
deleting a user could cause thousands of update-cached-due-dates
jobs to be enqueued (one per assignment per enrollment; in the
referenced ticket, the test student had 13 enrollments and there
were 88 assignments, yielding 1,144 jobs, causing the request
to time out).

fix this by
 (1) using a batch job to update all assignments in the course,
     instead of a job per assignment
 (2) when deleting a user with multiple enrollments in a course,
     only run the update cached due date job once per course

test plan:
 0. run in "production" configuration (i.e., in QA portal)
 1. have a course with 10 sections and 100 assignments.
    I suggest creating these in the console, e.g.

    course = course.create! name: "CNVS-8068"
    10.times { |x| course.course_sections.create! name: "section #{x}" }
    100.times { |x| course.assignments.create! name: "assignment #{x}" }

 2. enter student view mode in this course
 3. reset the student view student
 4. verify 1000 jobs were not created (and the request doesn't time out)

fixes CNVS-8068

Change-Id: If00dd3197b70df42b0f9ec18303b02594861f69f
Reviewed-on: https://gerrit.instructure.com/25160
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-16 21:04:03 +00:00
Cody Cutrer 920a6bffe9 fix mysql problems with boolean cast and temp tables
refs CNVS-7032

 * mysql doesn't have boolean
 * mysql will auto-commit the transaction unless you explicitly say
   TEMPORARY when dropping the temp table

Change-Id: Iaca3ddd5768f509a0b610925f601e1712e9b7d42
Reviewed-on: https://gerrit.instructure.com/22666
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2013-07-26 19:38:23 +00:00
Cody Cutrer 84ba40dcad optimize GroupMembership#update_cached_due_dates
fixes CNVS-6887

use a smarter query, and skip it altogether for account groups

test plan:
 * regression test adding/removing users to groups in a course with
   overrides and stuff.
 * an sis import of account level groups should still work

Change-Id: Ie9943af04ce6aab31f9f0d76f51c7474c1299616
Reviewed-on: https://gerrit.instructure.com/22317
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-07-18 22:15:18 +00:00
Cody Cutrer 011cd66860 strand per shard for due date cacher
Change-Id: I6e4ba16a3108af9ea462ebfc3ee30e4d65ac54d6
Reviewed-on: https://gerrit.instructure.com/21763
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-06-26 21:42:15 +00:00
Cody Cutrer cae52b935d optimize DueDateCacher
don't load 1000 assignments, just use a range of ids

test plan:
 * data migration should not fail
 * on-demand recalculations should not fail

Change-Id: I7da3244a08ab6f61b8393c9f9d85257b181157cc
Reviewed-on: https://gerrit.instructure.com/21738
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-06-26 16:21:08 +00:00
Jacob Fugal a771fe00ef replace submissions.late column with .cached_due_date
refs CNVS-5805

with efficient calculation of all due dates for any submissions for a
given assignment when related records (the assignment, its overrides,
related enrollments, and related group memberships) changes.

compares this cached due date to the submitted_at or current time when
determining lateness.

populates the column for existing submissions in a post-deploy
data-fixup migration.

test-plan:
  - run lib/data_fixup/initialize_submission_cached_due_date.rb
  - all submissions' cached_due_dates should be updated over several
    jobs
  - enroll a student in a course and create submissions in that course
    - create a second enrollment in a second section; the
      cached_due_dates for the user's submissions should recalculate
    - destroy the second enrollment; the cached_due_dates for the user's
      submissions should recalculate
    - create a group assignment
      - add the student to a group in the assignment's category; the
        cached_due_dates for the user's submissions should recalculate
      - remove the student from the group; the cached_due_dates for the
        user's submissions should recalculate
  - enroll more students in the course
    - change an assignment's due date; the cached_due_dates for the
      assignment's submissions should recalculate
    - create an override for the assignment; the cached_due_dates for
      the assignment's submissions should recalculate
    - change the due date on the override; the cached_due_dates for the
      assignment's submissions should recalculate
    - delete the override; the cached_due_dates for the assignment's
      submissions should recalculate
  - during any of the above recalculations:
    - the most lenient applicable override should apply
    - if the most lenient applicable override is more stringent than the
      assignment due_at, it should still apply
    - the assignment due_at should apply if there are no applicable
      overrides

Change-Id: Ibacab27429a76755114dabb1e735d4b3d9bbd2fc
Reviewed-on: https://gerrit.instructure.com/21123
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jacob Fugal <jacob@instructure.com>
2013-06-10 19:11:31 +00:00