Commit Graph

68 Commits

Author SHA1 Message Date
Cody Cutrer 223aedadff rubocop: update to 1.21
[skip-stages=Flakey]

new cop autocorrected: Layout/LineEndStringConcatenationIndentation

Change-Id: Ib59a7fadeb2d9af68d90eb82b9ac855dead29121
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274524
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-28 02:40:46 +00:00
Cody Cutrer 649ed90556 RuboCop: Layout spec/lib
[skip-stages=Flakey]

Change-Id: I8ea79181841e3da783801500e26f630770c4d672
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274150
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 19:17:20 +00:00
Jake Oeding 78e41c1241 refactor gradebook importer
reduce dependence on mutation of rows and adding of
offsets to calculate assignment indices. filter out
non assignment header columns earlier via regex.

closes EVAL-1747
flag=none

test plan:
- have a course with multiple assignments and assignment groups
- export the gradebook to csv
- swap some of the assignments so they have a non-default
  ordering in the csv
- move one of the assignment group columns so that it is between
  normal assignments
- alter/add grades for the assignments that were moved
- import the modified csv via the gradebook import
- check that all the assignments with modified grades were
  picked up and that there is no new assignment for the
  assignment group that was placed between assignments

Change-Id: I416763e3806d636ef86740e1608c26d26c29f8ee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267038
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Dustin Cowles <dustin.cowles@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Jody Sailor
2021-06-21 17:11:07 +00:00
Jake Oeding 181d575dca set csv export ordering to match gradebook
set users' gradebook column order preferences
as the sort order for assignment columns in the
gradebook csv export

closes EVAL-321
flag=gradebook_csv_export_order_matches_gradebook_grid

test plan:
- enable the feature flag
- in the gradebook, swap the order of some assignments
  and then export to csv
- the assignment order should match the order you
  created in the gradebook
- change some grades in the csv just exported
- import the modified csv and ensure the updated grades
  are picked up
- now delete an assignment and repeat the export process.
  said assignment should no longer appear in the export
- back in canvas, create a new assignment (do not make
  any changes to the gradebook column order at this point)
- export once more, the new assignment just created should
  come after all the original assignments (since it has
  no preference)
- in all the above steps, the assignment group and course
  total columns should come after all assignments
- test the 3 scenarios above again with the feature flag
  disabled. the assignments should be ordered by
  assignment group position and then assignment position
  instead of the gradebook column order
- other things to consider: grading periods, override
  scoring, custom columns, etc. exporter and importer
  should behave as defined above with respect to the
  feature flag status under all these circumstances

Change-Id: Ie248a7ffe663d28ddd1f2984e59a0f307ad41c52
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266000
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Jody Sailor
2021-06-14 21:20:22 +00:00
Adrian Packel 5532e9b910 Handle imports with no override column
If a course with final grade override enabled imports a CSV with no
override score columns, don't bother querying for existing override
scores at all. This fixes a crash that could occur when calling
find_each on a "none" scope.

fixes EVAL-1502
flag=import_override_scores_in_gradebook

Test plan:
- Have a course with final grade override enabled
- Enable the "Import Override Scores in Gradebook" site-admin flag
- Import a CSV without any "Override Score"
  - The import should complete and should not throw an "invalid CSV file"
    error
- Try importing a CSV with at least one "Override Score" column for good
  measure

Change-Id: Id0cf490c5862144b5a67524156ea440b4514c0c5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/259397
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-02-24 18:54:11 +00:00
Spencer Olson ae98fc2084 gradebook exporter: don't show scores for anonymized submissions
closes EVAL-1314
flag=none

Test Plan:
1. Create an anonymous assignment. Grade a few students anonymously in
   SpeedGrader. Don't post grades yet.
2. Export the Gradebook.
3. Open the exported CSV. Verify that all scores for the anonymous
   assignment show as "N/A" and the header shows "Manual Posting (scores
   hidden from instructors)".
4. Make some changes to scores in the CSV, making sure to change at
   least one score for the anonymous unposted assignment, and one score
   for an active, non-anonymous assignment.
5. Import the changed CSV. Verify the changes to the anonymous
   assignment are ignored, and the changes to the non-anonymous
   assignment are not ignored.
6. Post grades for the anonymous assignment.
7. Re-export the Gradebook.
8. Open the exported CSV. Verify that all scores for the anonymous
   assignment are now shown.
9. Make some changes to scores in the CSV for the anonymous assignment.
10. Import the changed CSV. Verify the changes to the anonymous
    assignment are no longer ignored.

* Edge case: try steps 1-10 but with your locale set to anything other
  than English. This will ensure the Gradebook Importer logic can
  handle and identify headers such as, "Manual Posting (scores cachés
  aux instructeurs)". Note that "Manual Posting" will never be
  translated (always English), but the content in parentheses will be
  translated. This is expected.

Change-Id: Ief17a06bd97c15b4138531030ed50ba19f2e03fa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/253151
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
2021-01-11 20:31:49 +00:00
Adrian Packel ce427bccc0 Show override score changes on confirm screen
If a CSV file is imported and contains override score changes (which
will only be processed in the first place if the relevant feature flag
is on), show the changes on the upload confirmation screen and allow the
user to edit them as with assignments. Do not actually apply the
changes yet.

closes EVAL-1351
flag=import_override_scores_in_gradebook

Test plan:
- With the "Import Override Scores in Gradebook" feature ON:
  - Upload a CSV with changes to override scores
  - As with assignments, if any student's override grade has changed for
    a given grading period, the upload confirmation screen should show
    the old and new override scores for all students for that grading
    period
  - Ditto for override scores for the whole course
  - Any changes that would decrease a student's override score, or
    remove a score, should be highlighted in red
  - You should be able to edit the scores inline and have the changes
    stick
  - Note that confirming/submitting will not actually submit the
    override changes
- With the "Import Override Scores in Gradebook" feature OFF:
  - Changes to override scores in imported CSVs should not be
    acknowledged on the confirmation page

Change-Id: Ie27a88bda45ce39f6e879c92d8ab2b38685797ad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254944
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Jody Sailor
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
2020-12-22 23:03:40 +00:00
Ethan Vizitei a1307ff8b7 no sentry noise on malformed gradebook imports
closes FOO-1328
flag=none

TEST PLAN:
  1) upload a badly encoded file for gradebook
  2) the job should fail, as it already does,
     but without notifying sentry (logs still happen)

Change-Id: I3b09f93a2138bd843e0229bf25e15f54593879b7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/255081
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-12-16 19:11:31 +00:00
Adrian Packel f5dc989ca8 Allow importer to recognize override score changes
Allow the gradebook importer to recognize changes override scores and
record them as part of a gradebook upload. (The changes are not yet
shown to the user on the confirmation page or applied in any way; they
are only stored in the temporary upload object created on the backend.)

closes EVAL-1293
flag=import_override_scores_in_gradebook

Test plan:

Run the following tests with two CSV files: one with grades for the
course as a whole, and the other with grades for a specific grading period.
For the latter file, you can either ensure the separate "export grading
periods in column headers" commit is merged and the associated feature
flag turned on when you export, or you can fake it by taking an existing
file and renaming the "Override Score" column to include the grading
period (e.g., "Override Score (Fall 2020)").

- Have a course with override grades enabled and some grading periods
  active
  - Give out some override grades for the course and for individual
    grading periods
  - Export a CSV
  - After exporting, make some changes to override scores in either the
    gradebook or the CSV file
- With the feature flag ENABLED:
  - Open the Network tab or equivalent in your browser's developer tools
  - In Gradebook, import the CSV file from earlier
  - On the confirmation page, check the network requests for a request
    to gradebook_uploads/<id>/data
    - Examine the response JSON, and look at the "students" hash
    - Assuming there was at least one student with an override score
      change, each student hash should contain an "override_scores"
      entry with override score data (even if unchanged)
    - If there were no override score changes at all, none of the
      "override_scores" arrays should contain any elements
  - The actual "review changes" page will not recognize the changes yet,
    so if it claims that there are no changes, that's fine
- With the feature flag DISABLED:
  - Upload a modified CSV and examine the response JSON as above
  - It should not contain any override grade changes for any students

Change-Id: I6f4d391e8c639b1894306e325c5d1c1736dd58e5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252696
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2020-12-02 21:46:39 +00:00
Cody Cutrer 81d0bbc465 add # frozen_string_literal: true for specs
Change-Id: Id508bec1817937b1c24c29f1db7221e09cb9c2ab
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251157
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:48:35 +00:00
Kai Bjorkman e902ee80e0 remove gradebook reserved importer bugfix flag
closes EVAL-644
flag=none

Test Plan:
- Specs pass

Change-Id: I53f7ed7c859a1742425c624517c5233dbe7c4d5b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246126
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
2020-08-31 18:33:00 +00:00
Gary Mei cc2174c56a fix grade imports with spaces in grades
fixes EVAL-1035
flag=none

Test Plan
- Export the gradebook.
- In the csv, assign 1 grade to have a leading space, 1 to have a
trailing space, and 1 with neither.
- Import the gradebook.
- Verify that the changes are present without issue.

Change-Id: I62a6696bd6dbbb2b08e1ff4e3133c1b4522e2c2f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244781
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Syed Hussain <shussain@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2020-08-13 20:09:06 +00:00
Keith T. Garner ee3b30d0ec ignore reserved and non-active custom columns on gradebook import
The gradebook importer will now ignore reserved names it counts on, such
as "Section".  Also, it will ignore custom columns that are not in an
active workflow state, bringing the importer in line with the exporter.

closes APG-122

flag=gradebook_reserved_importer_bugfix

test plan:
 - Ensure that the gradebook_reserved_importer_bugfix feature flag is On
 - Part 1:
   - Create a custom column (either via the rails console or the API)
     and set the workflow_state to hidden or deleted
   - Create a gradebook import with that custom column and data in it
   - Note that the column is ignored during upload
 - Part 2:
   - Create a custom column, with validations skipped, via the rails
     console with a reserved name such as "Section."
   - Create a gradebook import with that custom column and data in it
   - Note that the column is ignored during upload

Change-Id: I69692738a6ee9e96ab4f404f33ae6ba193149d9e
Reviewed-on: https://gerrit.instructure.com/211545
Tested-by: Jenkins
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Nick Pitrak <npitrak@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-10-15 18:13:39 +00:00
Christine Yan 44298af864 Excuse submissions labeled EX in pass-fail in importer
fixes GRADE-2251

Test Plan:
- Create a course, teacher, and assignment with pass-fail grading
- From gradebook, export the CSV
- In the CSV, change the assignment's grade to 'EX'
- Import CSV back to gradebook
- Assignment's grade should now be excused

Change-Id: I58b5f57da774e262d8176f2369f2b74ff0b3f100
Reviewed-on: https://gerrit.instructure.com/198757
Tested-by: Jenkins
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2019-07-02 21:14:07 +00:00
Rob Orton f7255e9b52 add integration_id to grade export
fixes GRADE-2229

test plan
 - export gradebook
 - it should work
 - set root_account to include integration_ids in gradebook
 - export gradebook
 - it should include integration_id
 - account grade export reports should also use account setting
 - import grade export that includes integration_id
 - it should import with out error

Change-Id: I7b5eb980492c3ee657e87df27217263c36615cb4
Reviewed-on: https://gerrit.instructure.com/196982
Tested-by: Jenkins
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
2019-06-15 07:38:18 +00:00
Adrian Packel e4942e3cf6 Show manual posting in CSV export
closes GRADE-1859

Test plan:
- Set up a course with Post Policies enabled
  - Ensure at least one assignment is manually-posted
    - (i.e., `assignment.post_mnually?` returns true)
    - (can be set at the assignment level or via the default course policy)
  - Export grades to CSV
    - In place of the previous "muted" row, there should be a row
      containing "Manual Posting" for manually-posted assignments
      and no value for other assignments
  - Turn manual posting off for all assignments in the course
  - Re-export to CSV
    - This time, the "Manual Posting" line should be absent
- Set up a course with Post Policies disabled
  - Check that exporting behaves as it did previously
    - (i.e., it should check for muted assignments and include a "muted"
      row if there are any)

Change-Id: I4d52b28acf910b0a9acb652cbb10686c44075689
Reviewed-on: https://gerrit.instructure.com/190389
Tested-by: Jenkins
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2019-05-01 23:35:59 +00:00
Adrian Packel ee1f5b4fc5 Add final grade override to CSV exports
closes GRADE-1998

Test plan:
- Have a course with Final Grade Override enabled
  - Set up at least one grading period and some assignments
    - Enable "show totals for all grading periods" option for the
      grading period set
  - In new Gradebook, turn on the "Allow final grade override" setting
    - (Note this does *not* affect whether the new columns are
      included; it's just to let you enter values)
  - Leave some assignment grades and some override grades
- Export to CSV for the following scenarios:
  - With a grading standard enabled for the course
    - With a grading period selected
      - CSV should include override score/grade for the period
    - With no grading period selected
      - CSV should include override score/grade for the whole course
  - With no grading standard enabled for the course
    - With a grading period selected
      - CSV should include override score for the period
    - With no grading period selected
      - CSV should include override score for the whole course
- Re-import one of the above CSVs
  - The import should ignore the above columns, even if changed
- Disable the Final Grade Override feature flag
  - Export to CSV
    - The CSV file should NOT contain either override column

Change-Id: Ic352bb508007f13d6025390460e411aac512ccbb
Reviewed-on: https://gerrit.instructure.com/181265
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Matthew Goodwin <mattg@instructure.com>
2019-02-21 17:33:27 +00:00
Adrian Packel 7a0ff000d4 Set format of CSV exported/imported values
Export scores in CSV files with 2 digits of precision to match what is
shown in Gradebook, and compare against existing scores at that same
precision when importing. Do not include thousands separators.

fixes GRADE-871

Test plan:
- Have a course with some students and a points-based assignment
- Enter a score greater than one thousand
- Enter a score with three decimals of precision that rounds up
  (e.g., 123.456); this will display as 123.46
- Export the CSV file
- In the CSV:
  - Scores greater than one thousand should *not* include any
    thousands separators
  - All scores should appear with a precision of two decimal places
    (even if there is no decimal component), with whatever rounding
    that entails
- Re-import the CSV without modifying it
  - You should be told that no changes were found (i.e., the lack of
    a thousands separator and the rounding should not cause false
    positives)
- Make some changes to those values and reimport the CSV
  - The import page should identify your changes as expected

Change-Id: Ia88d257b4ea57bf72ac25773fdd1ccdbd0ee605b
Reviewed-on: https://gerrit.instructure.com/173856
Tested-by: Jenkins
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-12-11 18:49:57 +00:00
Adrian Packel b71575d6bd [ci no-cached-dist] Handle custom columns properly when importing
When importing a gradebook CSV and and analyzing what changes have been
made, map changes to custom columns properly and do not attempt to
include deleted or hidden columns.

fixes GRADE-1616

Test plan:
- In a course with some students, set up four custom columns
  (referred to as C1 through C4); for now, don't change any
  settings on them
- In new Gradebook, set some values for the columns
- Adjust them as follows:
  - C1: deleted
  - C2: hidden
  - C3: read-only
  - C4: [leave as is]
- Export a CSV
  - The CSV should contain C3 and C4 but not the other two
    columns (this behavior has not changed)
- Twiddle some assignment scores and custom-column values in the CSV
- Import the edited CSV and check the following on the proposed
  changes screen:
  - Changes to C4 are shown as expected
  - Any changes to assignment scores are shown as expected
  - Changes to C3 are *not* shown, and the warning message about
    preventing changing read-only columns is shown at the bottom
  - Otherwise, everything is as you'd expect: the importer isn't
    attempting to replace a custom column with the section name
    or perpetrate any similar skulduggery

Change-Id: Ib1ebcec6820120288e67c1652cb5496a8b8240a7
Reviewed-on: https://gerrit.instructure.com/167149
Reviewed-by: Keith Garner <kgarner@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
Tested-by: Jenkins
2018-10-11 21:23:35 +00:00
Ryan Kuang d9d2d54e4b Add custom columns to gradebook imports
When importing a gradebook, the csv import can include custom columns

closes GRADE-1315

Test Plan
 - Create a course with (not read_only) custom columns in the gradebook
 - Export the gradebook to csv
 - Make changes to the data in the writable custom columns in the csv
 - Import the csv into gradebook
 - Run the delayed jobs server
 - The gradebook will make changes in writable custom columns with
   or without additional changes in assignment columns
 - If no changes are made, or changes in non writable columns are made,
   the importer will skip these changes

Change-Id: I0a529ea8727be864f6105b9e6b256f75e1c8c471
Reviewed-on: https://gerrit.instructure.com/156068
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-08-24 21:15:03 +00:00
Gary Mei e1a58a0239 fix gradebook import of moderated assignments
Uploading a csv with moderated assignments would fail because
the attributes that would be checked weren't previously loaded in.

fixes GRADE-1374

Test Plan
- Create a moderated assignment.
- Export the gradebook.
- Modify the grade for the moderated assignment.
- If you are the final grader, uploading should work.
- If you are not the final grader, uploading should have no effect.

Change-Id: If0cef730e3b22cd9b049a9c44133cb7a389a6e85
Reviewed-on: https://gerrit.instructure.com/157526
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-17 15:54:06 +00:00
Gary Mei 5a3437c251 fix semicolons as delimiters in gradebook importer
fixes GRADE-1324

Test Plan
 - Have DelayedJobs running.
 - Create a course with one teacher and at least one student.
 - Create an assignment for that course.
 - Go to the User settings of the teacher and turn on the option to
   use semicolons in Gradebook Export.
 - Go to the Gradebook as the teacher and export the Gradebook.
 - Open the csv file and change the grade a bit.
 - Verify that the csv did indeed use semicolons rather than commas.
 - Import that csv file back into the Gradebook.
 - Verify that the import worked successfully.
 - Turn off the option for using semicolons and instead use commas.
 - Verify that export/import works with commas using the same above
   steps.

Change-Id: I42870aeb3ff4064f3db39ed1b67681e2acc4ed8e
Reviewed-on: https://gerrit.instructure.com/156648
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Adrian Packel <apackel@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-07-10 21:13:27 +00:00
Ryan Kuang 6e2d127d8d Add custom columns to gradebook imports/exports
When exporting a gradebook,
the csv should include custom columns listed at the final columns.

fixes GRADE-1275

Test Plan (Exporting)
 -Create a course
 -Use the public api to add custom columns, 1 read only and 2 writable
  (POST /api/v1/courses/:course_id/custom_gradebook_columns)
 -Use the public api to add data into those custom columns
  (PUT /api/v1/courses/:course_id/custom_gradebook_columns/:id/data/:user_id)
 -Navigate to the gradebook for the course and inspect the columns
 -Export to csv
 -Check if the csv has the proper columns as the gradebook, the read only column
  should not have changed, while the writable columns should display the changes

Test Plan (Importing)
 -Follow the steps above to export to csv
 -Change any data in an assignment column
 -Make sure the column changed is not (read only)
 -Save the csv and upload into gradebook
 -Check if the assignment changes appear in the gradebook

Change-Id: I36a7d53af7b86ffcb6cdfbc4f78effcb0df9a3fe
Reviewed-on: https://gerrit.instructure.com/155027
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Keith T. Garner <kgarner@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2018-07-10 17:36:50 +00:00
Adrian Packel 7d2a89fbbb add unposted scores to gradebook import/export
Include unposted scores and grades for assignment groups as well as
current/final scores in the Gradebook CSV export.

closes GRADE-762

Test plan:
- Set up a course with some students and one or more assignment groups.
- Add some assignments and record some grades. Mute at least one of the
  assignments.
- Export the grades from the course. Check that the resulting CSV file
  includes columns for unposted scores for each assignment group you
  exported and that they correctly reflect the values for unposted
  scores.
- Also check that the CSV includes corresponding unposted columns for
  each summary column (current score, final score, and so on) and that
  each new column's value takes into account the scores of unposted
  assignments.
- Finally, import the CSV file you just exported and make sure there
  are no errors due to the addition of the new columns (as with the
  rest of the summary columns, they should be ignored by the importer).

Change-Id: I3bbbe6b5ad93816d929fa72b48a6006271825ed4
Reviewed-on: https://gerrit.instructure.com/138047
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2018-01-29 18:20:24 +00:00
Matt Taylor 9bd0936399 gradebook export and import localized CSV
fixes GRADE-271

Test Plan:
  1. Modify a local copy of config/locales/is.yml, adding
     the following translation key:
       csv:
         column_delimiter: ";"
  2. Change Canvas settings to Íslenska (Icelandic):
     - root account settings
     - user profile
     - course settings
  3. Create at least two students and at least two
     assignments for a course.
     - name at least one assignment with non-ASCII
       Icelandic characters such as "ð"
     - name at least one assignment with multi-byte
       Unicode characters, such as "文章"
  4. Grade the assignments, covering the following:
     - decimal grade (with comma as decimal separator)
     - integer grade
     - empty grade
  5. Go to (old) gradebook, export grades and download it
  6. Configure Microsoft Excel for Icelandic language
  7. Open the download in Excel. Verify that rows and
     columns are interpreted correctly, and that non-
     ASCII characters are displayed correctly.
  8. Import the download in Google Sheets, specifying
     semicolon as the custom delmiter.  Repeat the
     verification from (7)
  9. Repeat steps 3-8 using new gradebook.
  10. Repeat steps 3-8 using US English for all
     language settings.
  11. Copy the Icelandic and English grade exports and
     modify some student grades
  12. Import the modified Icelandic export file, while
     configured for US English.  Verify that student
     grades are updated.
  13. Import the modified English export file.  Verify
     that student grades are updated.

Change-Id: Icf7fcdadae5b22fad524a224d956fd93c2438b57
Reviewed-on: https://gerrit.instructure.com/128786
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Indira Pai <ipai@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-12-06 21:03:48 +00:00
Simon Williams ad1dfbfb3a better failure handling for invalid gradebook import csv headers
closes CNVS-39159

test plan:
- upload a gradebook import with an invalid header row
- it should behave the same as previously, from the user perspective
- check failed jobs, the jobs should not be listed there

Change-Id: I9a0c1fa61e6b3e105fe01398331c5dd8b37c705b
Reviewed-on: https://gerrit.instructure.com/125356
Reviewed-by: Matt Taylor <mtaylor@instructure.com>
Tested-by: Jenkins
QA-Review: Neil Gupta <ngupta@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2017-09-27 23:05:36 +00:00
Cody Cutrer cdf5050f57 spec: mocha => rspec-mocks for lib
Change-Id: I5cd79ee9256d18e782f2ec36f97425fbb1e598d3
Reviewed-on: https://gerrit.instructure.com/120499
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-07-26 19:20:32 +00:00
Landon Wilkins a55623016d da licença part 47
add consistent license headers to all source files

Change-Id: I8d372efee113550ada3255f32ec6f1858e5520c4
Reviewed-on: https://gerrit.instructure.com/110152
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-28 17:59:55 +00:00
Neil Gupta 7298b8749f Get rid of multiple_grading_periods feature flag
Fixes CNVS-27109

Test plan:
Regression test everything related to multiple grading periods.

In particular, make sure:
* there is no mention of the multiple grading periods feature flag on
  the account or course features pages
* make sure grading periods UI always shows up on the account grading
  standards page
* make sure the grading periods UI only shows on the course grading
  standards page if legacy course grading periods exist for that course
  (see below)
* grading period dropdowns only show up everywhere else if there are
  grading periods to show. Otherwise, it should behave as if MGP is
  "disabled"
* Grade calculation should work as expected with and without grading
  periods

To create legacy course grading periods, you have to use rails console:
1. Find your course:
      course = Course.find(<id>)
2. Create a grading period group:
      group = course.grading_period_groups.create!(title: "2017")
2. Create a grading period:
      group.grading_periods.create!(
        weight: 1,
        title: 'Fall',
        start_date: 5.days.ago,
        end_date: 10.days.from_now
      )

Here's the list of known places grading periods can be seen in the UI:

Instructor Assignments page
  (https://community.canvaslms.com/docs/DOC-2615)
Student Assignments page
  (https://community.canvaslms.com/docs/DOC-3123)
Gradebook (https://community.canvaslms.com/docs/DOC-2785)
Gradebook Individual View
  (https://community.canvaslms.com/docs/DOC-2788)
Course Settings grading schemes page
  (https://community.canvaslms.com/docs/DOC-4042)
Student Grades page (https://community.canvaslms.com/docs/DOC-1291)
Dashboard global Grades page
  (https://community.canvaslms.com/docs/DOC-5464)

Change-Id: Iefac4b08120bd1699d4ed98bcb418089eec9b3b8
Reviewed-on: https://gerrit.instructure.com/99744
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-01-25 20:35:18 +00:00
Simon Williams ece65b5a89 spec: rename the `user` helper to `user_factory`
closes CNVS-34042

test plan: specs should pass

Change-Id: I20709a69f0cb28fb55eba18ca81f89f4d7673b56
Reviewed-on: https://gerrit.instructure.com/98426
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2016-12-27 20:25:25 +00:00
Shahbaz Javeed 95283746ea prevent grading if submission is due in closed grading period
closes CNVS-32229
closes CNVS-32232

test plan:
* Create a course with MGP enabled and two grading periods in
  the default term
* Create two assignments for this course, one in a closed GP and
  one in an open GP
* To test overrides, create the following as well:
  * For one of the students, make the open assignment due in the
    closed grading period
  * For another student, make the closed assignment due in the
    open grading period

* Ensure the following steps work for all assignment/student
  combos due in a closed grading period.

** CNVS-32229 **
* Login as a teacher
* Go to speedgrader for the assignment in the closed GP
* Notice that the grade input is locked down
* Right click on the locked-down input and select 'Inspect'
* Remove the 'ui-state-disabled' class and remove
  readonly="readonly" from the input field's HTML
* Notice the input is no longer grayed out and you can enter
  a grade
* Enter a grade and tab out of the input
* You should see an error message that says something went wrong
  and notice in the Network tab of your dev tools that the AJAX
  post failed, meaning the submission was not gradeable
* Refresh the page and notice the grade is not there.
* Verify it isn't there in Gradebook either

* Login as an admin
* Go to speedgrader for the assignment in the closed GP
* Notice that the grade input is *not* locked down
* Enter a grade and tab out of the input
* You should *not* see an error message that says something went
  wrong meaning the submission was graded successfully
* Refresh the page and notice the grade is there.
* Verify it is also present in Gradebook

** CNVS-32232 **
* Login as a teacher
* Go into a gradebook that has an assignment that is
  locked down because it is in a closed grading period
* Notice that the grade cells for the assignment are locked
  down (because the submissions fall in a closed grading period)
* Right-click on one of the locked-down cells and select 'Inspect'
* Remove the 'grayed-out' and 'cannot_edit_in_closed_grading_period'
  classes
* Notice the cell is no longer grayed out and you can enter a grade.
* Enter a grade
* Click on another cell.
* You should see an error message that says something went wrong
  and in the Network tab of your dev tools verify the AJAX post
  failed, meaning the submission was not gradeable
* Refresh the page and notice the grade is not there

* Login as an admin
* Login as a teacher
* Go into a gradebook that has an assignment that is
  in a closed grading period
* Enter a grade in a cell that should be due in a closed grading
  period
* Click on another cell
* You should *not* see an error message that says something went
  wrong meaning the submission was graded successfully
* Refresh the page and notice the grade is there.
* Verify it is also present in Gradebook

Change-Id: Ia80e4de626616309c5e9dffb78ed0f9671ad1076
Reviewed-on: https://gerrit.instructure.com/95687
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-12-08 21:01:07 +00:00
Derek Bender 3870709ea5 speedup GradebookImporter by removing N+1s
This removes N+1 from the importer by preloading grading
periods and admin_of_root_account?.
Fix imports so that submissions with no due date fall
into the last period for the course.

closes: CNVS-26720

test plan:

1. Test that a gradebook upload can update a submission's
   grade in a grading period where it is the last grading
   period for the term (course) and the due date is nil
2. Test that an update fails if the above conditions are met
   and the grading period is closed
3. Finally test for no N+1s during the import:
 - have a course with grading periods and assignments
 - import a gradebook csv as a basic teacher enrollment
 - notice in the logs that there are not several (1 per
   submission) N+1s for Grading Periods during import parsing

Change-Id: Ia595eaa50e44a2813727803aa13b897ee29fbd00
Reviewed-on: https://gerrit.instructure.com/91623
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-10-05 16:22:18 +00:00
Spencer Olson 3c934f9fa6 gradebook upload respects close date
close date will now be respected when uploading a gradebook CSV.
this means a) grades cannot be changed if they fall in a closed
grading period, and b) assignments cannot be created via upload
if they would fall in a closed grading period.

closes CNVS-26720

test plan:
1. turn multiple grading periods on
   for a course, go to the gradebook
   and click 'import'.
2. log in as a non-admin teacher and verify via
   CSV upload:
   a) trying to change the grade for a submission
      that falls in a closed grading period does
      not change the grade and displays a message
      before uploading that says some submissions
      were skipped because they were not gradeable.
   b) changing the grade for a submission with a due
      date that does not fall in a closed grading period
      is allowed.
   c) trying to create a new assignment (by adding
      a new assignment column in the CSV) does not
      succeed if the last grading period in the course
      is closed. also verify a message is displayed
      saying new assignments could not be created
      because they would fall in a closed grading period.
   d) creating a new assignment (by adding a new assignment
      column in the CSV) succeeds if the last grading period
      in the course is not closed.
3. log in as a root account admin and verify step 2a allows
   the user to change a submission's grade and step 2c allows
   the user to create a new assignment.
4. turn off multiple grading periods and verify gradebook upload
   behaves normally.
Change-Id: Ic4e9e1b08d7910cf99b5c4cff57d921e80af9e19
Reviewed-on: https://gerrit.instructure.com/88540
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-09-20 16:10:04 +00:00
Keith Garner 74e1b6ce67 honor gradebook inactive/concluded settings in export
Gradebook export now honors the settings from gradebook related to
showing active and inactive enrollments.

fixes CNVS-30640

test plan:
 - Create a course with an assignment, and three
   students, one active, one inactive, and one concluded.
 - In gradebook turn off show inactive and show concluded.
 - Export the gradebook and note that only the active student shows.
 - In gradebook turn on show inactive.
 - Export the gradebook and note that both the active and inactive
   students show.
 - In gradebook turn off show inactive and turn on show concluded.
 - Export the gradebook and note that both the active and concluded
   students show.
 - In gradebook turn on show inactive and turn on show concluded.
 - Export the gradebook and note that all the students show
 - Edit the export and change the grade for all students.
 - Upload the export and note that only the active and inactive students
   are graded

Change-Id: I40dfe08991049f0689e05588f189b33a59cf9813
Reviewed-on: https://gerrit.instructure.com/86570
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-08-04 18:13:09 +00:00
Jeremy Neander dc88075b2a associate grading period groups with root accounts
Grading Period Sets will now be associated directly with accounts
instead of enrollment terms.

closes CNVS-29932

test plan:
 1. Visit the grading standards page for a given account
 2. Create a Grading Period Set
 3. At the Rails Console, verify:
     a. The Grading Period Set was created
     b. It has the given attributes
     c. `account.grading_period_sets` contains the created set
 4. Visit the grading standards page for a given account
 5. Delete the Grading Period Set
 6. At the Rails Console, verify the set was soft-deleted

Change-Id: I6ddbfeb2899aeb80d4594c03efc1b6788506f781
Reviewed-on: https://gerrit.instructure.com/83965
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-07-01 20:15:56 +00:00
Jeremy Neander 4bfa2d9037 remove account association from grading periods and their groups
Accounts will no longer be directly associated with grading periods or
grading period groups.

A grading period group can:

* have only one or more enrollment terms
* belong only to a course (for legacy data)

Testing Notes:
* To create a GradingPeriodGroup for an EnrollmentTerm:
    * Create an EnrollmentTerm `enrollment_term`
    * `group = GradingPeriodGroup.new(title: "Example")`
    * `group.enrollment_terms << enrollment_term`
    * `group.save!`

test plan:
 A. repeat tests with commit at SHA: 861015a
 B. grading standards for an account
     1. find or create an Account
     2. visit `/accounts/[account id]/grading_standards`
     3. verify there is no grading periods UI
     4. verify that grading schemes are still manageable
 C. grading standards for a course with grading periods
     1. find or create:
         a. an Account
         b. an EnrollmentTerm for the Account
         c. a Course for that Account
     2. associate the Course with the EnrollmentTerm
     3. in the Rails console `bundle exec rails console`
         a. create a GradingPeriodGroup for the Course
         b. create at least one GradingPeriod in the course group
         c. create a GradingPeriodGroup for the EnrollmentTerm
         d. create at least one GradingPeriod in the term group
     4. visit `/courses/[course id]/grading_standards`
     5. verify the grading period(s) on the course are present
     5. verify the grading period(s) on the term are not present
     6. verify that grading schemes are still manageable
 D. grading standards for a course with no grading periods
     1. find or create:
         a. an Account
         b. an EnrollmentTerm for the Account
         c. a Course for that Account
     2. associate the Course with the EnrollmentTerm
     3. in the Rails console `bundle exec rails console`
         a. create a GradingPeriodGroup for the EnrollmentTerm
         b. create at least one GradingPeriod in the group
     4. visit `/courses/[course id]/grading_standards`
     5. verify the grading periods on the term are present
     6. verify that grading schemes are still manageable

closes CNVS-26725

Change-Id: I7883cb421c87ebb91c818223c0483557fdd5e40a
Reviewed-on: https://gerrit.instructure.com/78167
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-05-26 23:37:52 +00:00
James Williams 12bd2627ab remove float rounding monkey-patch
used to turn 1.0.to_s to "1"

closes #CNVS-28310

Change-Id: I79106a4c0b42fe9b6d96097aaf9dd28a43024373
Reviewed-on: https://gerrit.instructure.com/75194
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-04-22 18:17:18 +00:00
James Williams 0777cba946 remove differentiated assignments feature checks
test plan:
* basic regression test of assignment overrides

closes #CNVS-27549

Change-Id: Ie463848b3831087efb3f9ec762dca6264055ee76
Reviewed-on: https://gerrit.instructure.com/73139
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-07 18:44:46 +00:00
Ethan Vizitei 31460a3f29 remove string contents pathway for gradebook upload
refs CNVS-27034

also refs gerrit c/71414/

this takes out the old "pass text" path that shouldn't be used
anymore for processing gradebook uploads.  No active code paths
are being changed.

TEST PLAN:
  1) gradebook imports still work

Change-Id: I3e0840c86ad7d0441164dcf6202932fc319d80e7
Reviewed-on: https://gerrit.instructure.com/71528
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-02-05 23:11:24 +00:00
Ethan Vizitei db3ba60b11 gradebook importer files through S3
closes CNVS-27034

stops dumping the file to the delayed job parameter, which was never a
good idea.  This sends it to S3 or file storage and streams it from
there on import. With the current setup, way more memory than necessary
is consumed while the job is running, and this is the way we process
large files in places like SIS anyway so this makes it more consistent.

TEST PLAN:
 1) gradebook imports should still work
 2) gradebook import jobs should not eat memory like popcorn

Change-Id: If5bc1aab2eba01c617d6c37480fe777000d80165
Reviewed-on: https://gerrit.instructure.com/71414
Reviewed-by: Derek Bender <djbender@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-02-05 16:06:02 +00:00
Strand McCutchen 94ed3ea48b when future GPs exist GB Importer can create assignments
When the GradebookImporter receives data which would create
a new assignment, but there exists a future grading period,
the new assignment is not creatable due to MGP logic. This
change makes assignment creation and editing of assignments
without due dates possible through the GradebookImporter.

fixes CNVS-25380

Test plan:

 0. In a course with a student…
 1. Create a grading period in the present and another in
    the future.
 2. Export the gradebook.
 3. Open the exported file and add a new assignment column
    to the gradebook.csv, putting the name in row 1 and
    possible points in row 2.
 4. Import the gradebook.
 5. Verify that the gradebook is imported and a new
    assignment is created.
Change-Id: I8f88547582c1a632c7129eac72a4ba4e7f12a624
Reviewed-on: https://gerrit.instructure.com/68498
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Christi Wruck
2016-01-19 18:12:45 +00:00
Spencer Olson a3b624100b always include sis login id in gradebook export
the sis login id is now always included in the
gradebook export, even if the teacher does not
have 'read sis' privileges.

closes CNVS-24913

test plan:
 * disable "Read SIS Data” permission for
   Teacher role
 * enroll teacher in a course with students
   and assignment items
 * download the Gradebook as the teacher
 * verify the “SIS Login ID” column is
   included in the CSV
 * enable "Read SIS Data" for Teacher role
 * download the Gradebook as the teacher
 * verify the "SIS Login ID" column is
   included in the CSV
 * in the examples above, verify that you
   can import the CSVs that were exported
   without any errors
 * verify that you can import a CSV that
   was exported before this change was made
   by a teacher without 'read sis data'
   permissions (a CSV without the 'SIS Login ID'
   column).

Change-Id: I4668e9aca30f3b3e271713280cd1e9c915d5b240
Reviewed-on: https://gerrit.instructure.com/67749
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2015-12-02 17:03:52 +00:00
Keith Garner 5e89f78e34 during gradebook import pass_fail partial scores passes, 0 fails
During Gradebook imports with pass_fail scores, points possible as
well as partial points in the CSV are considered passing.  0 will be
considered as failing. (The words "complete" and "incomplete" can
still be passed.)  Furthermore, the confirmation screen now reports
"complete" or "incomplete" instead of the points being imported For
the canvas user, this will result in a clearer understanding of the
grade changes happening as a result of the import.

fixes CNVS-21255
fixes gh-624

test plan:
  - Create a course with a student and 5 pass_fail assignments with 4
    points possible
  - In the gradebook:
    - Leave three assignment as null
    - Set one assignment to complete
    - Set one assignment to incomplete
  - Export the current gradebook to CSV
  - Edit the CSV to:
    - Set the first null assignment to 4 points
    - Set the second null assignment to 1 point
    - Set the third null assignment to 0 points
    - Set the complete assignment to 0 points
    - Set the incomplete assignment to 1 point
  - Import the CSV back into the gradebook
  - Observe:
    - On the confirmation screen the words "complete" and "incomplete"
      are used
    - The first null assignment shows as complete
    - The second null assignment shows as complete
    - The third null assignment shows as incomplete
    - The complete assignment now shows as incomplete
    - The incomplete assignment now shows as complete

Change-Id: I92921a3d88ad64f069573a2b27c41936151cec3c
Reviewed-on: https://gerrit.instructure.com/62206
Reviewed-by: Cody Poll <cpoll@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2015-09-14 16:41:31 +00:00
Strand McCutchen 5a2269ff8a GradebookImporter only allows editing current assignments
fixes CNVS-19924

When a teacher uploads a CSV with assignments in past
grading periods then they are not able to change grades.

Test plan

1. As an admin, create an account level grading period in
   the past.
2. Create assignments due during the past grading period.
3. Login as a teacher.
4. Navigate to the gradebook
5. Click export to download a CSV
6. Change the grade for the assignment in the past grading
   period.
7. Click the export button and use the wizard to upload
   your modified CSV.
8. You should receive a message telling you you are not
   allowed to edit the assignment in the past.

Change-Id: Ia8701c3504b03bd6ed35d0da1fe56cd8330ace79
Reviewed-on: https://gerrit.instructure.com/55297
Reviewed-by: Dylan Ross <dross@instructure.com>
Tested-by: Jenkins
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Strand McCutchen <smccutchen@instructure.com>
2015-08-05 23:30:54 +00:00
Cody Poll 43dfc9c10a GradebookImporter ignores readonly stuff
fixes CNVS-18853

When a gradebook with a custom grading scheme was exported, some extra readonly
columns are inserted. When imported, the importer did not check for
readonly-ness, and so these columns that shouldn't have been looked at were
construed as extra assignments.

After this commit, those extra columns should no longer be considered
assignments, but should be left alone.

Test plan:
  1. In a course without a custom grading scheme, export grades.
  2. Without changing anything, import the exported CSV.
  3. Verify that nothing has changed.
  4. Enable a custom grading scheme.
  5. Export the gradebook again.
  6. Import the new gradebook CSV.
  7. Verify again that nothing has changed.

Change-Id: I4b43cfd8ef390a4dc6e5393f243f1b98e922cd4a
Reviewed-on: https://gerrit.instructure.com/54882
Tested-by: Jenkins
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Adrian Foong <afoong@instructure.com>
Product-Review: Cody Poll <cpoll@instructure.com>
2015-06-18 21:52:03 +00:00
Josh Simpson 6821dfe030 gradebook csv upload: make parsing step async
Test plan:
  * uploading the gradebook should work like it used to (except it will
    even work for ridiculous-large courses)
  * try to break it by running multiple uploads in parallel / etc

Change-Id: I80dfe7babe320a1cee4021c59c5691d1df5382dd
Reviewed-on: https://gerrit.instructure.com/51499
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
2015-04-03 06:52:25 +00:00
Michael Nomitch 15361ae474 DA doesnt break new csv assignments
fixes CNVS-18185

test plan:
  - turn DA on
  - upload a GB csv with a new assignment
    that has student grades
    - the assignment and grades are
      properly uploaded
  - on a DA'd assignment, try to assign a grade
    to a students that can and cannot see it
      - students who cant see dont get a grade
      - students who can see do get a grade

Change-Id: I71fe1630c9d7eca3888550439782da24065f833c
Reviewed-on: https://gerrit.instructure.com/49401
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-26 19:22:29 +00:00
James Williams 2c69f3966b remove non-draft-state everything
test plan:
* basic regression test on assignments, discussion topics
 gradebook, and modules (mostly make sure the basic
 index/show/edit views aren't broken)

closes #CNVS-15563

Change-Id: I3411bfb7645b3c4bf8a4663e3e052b4402f899ba
Reviewed-on: https://gerrit.instructure.com/43609
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2014-12-10 17:57:18 +00:00
Cody Cutrer 9407689be8 rspec 3-ify spec/lib
refs CNVS-16239

Change-Id: Id6d24bf80d8c5722b7ba613e566edafefb177b89
Reviewed-on: https://gerrit.instructure.com/42660
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <braden@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Braden Anderson <braden@instructure.com>
2014-10-14 20:47:42 +00:00
Cody Cutrer 8399be4b1a don't use write_attribute for gradebook importer temp storage
refs CNVS-15830

test plan:
 * download the gradebook, change a grade, and upload it again
 * it should work

Change-Id: I0fe245b23aa24152a2a62ad919cf045120ae1c47
Reviewed-on: https://gerrit.instructure.com/41974
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-06 15:44:08 +00:00