Go to file
Spencer Olson 2560fba699 fix grade calculator to handle deleted enrollments
The grade calculator was throwing an error when computing scores for
a grading period for users with deleted enrollments. It will no longer
throw an error in that scenario.

closes CNVS-34643

1. Set up a course that is using grading periods with at least two
   active students.
2. Open a rails console.
3. Find the course.

   course = Course.find(2)

4. Find an active student in the course.

   student = course.students.active.first

5. Destroy all the student's enrollments.

   student.enrollments.destroy_all

6. Get a grading period ID for a grading period being used by the
   course.

   grading_period_id = GradingPeriod.for(course).first.id

7. Run the grade calculator for the student in the grading period and
   verify no errors are thrown.

   GradeCalculator.recompute_final_score(
     student.id,
     course.id,
     grading_period_id: grading_period_id
   )

Change-Id: If576c62fed75666c259d4753e8e7e7aeb1a135c9
Reviewed-on: https://gerrit.instructure.com/100961
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-02-02 20:17:53 +00:00
Gemfile.d update academic_benchmarks and switchman 2017-02-02 19:03:19 +00:00
app fix uglified component mounting 2017-02-02 20:17:44 +00:00
bin update spring and binstub 2016-10-06 20:25:33 +00:00
build move CI gergich formatters into canvas 2016-11-10 21:49:29 +00:00
client_apps Get webpack builds working again 2016-11-08 19:51:43 +00:00
config Add Live Events Publish Service 2017-02-02 19:09:58 +00:00
db/migrate change attachments.upload_error_message column to text 2017-02-02 16:20:06 +00:00
doc Fix bug in doc rendering to HTML 2017-02-01 23:15:55 +00:00
docker-compose Add Live Events Publish Service 2017-02-02 19:09:58 +00:00
frontend_build add Haitian 2017-01-27 23:53:17 +00:00
gems upgrade rubocop and rubocop-rspec to latest 2017-02-02 16:16:39 +00:00
guard upgrade guard and pin development gems 2017-01-03 22:05:03 +00:00
lib fix grade calculator to handle deleted enrollments 2017-02-02 20:17:53 +00:00
public eportfolio submission a11y improvements 2017-02-02 18:12:34 +00:00
script spec: bump test-queue 2017-01-25 22:41:12 +00:00
spec fix grade calculator to handle deleted enrollments 2017-02-02 20:17:53 +00:00
.babelrc Bump Babel to version 6 2016-07-15 21:55:10 +00:00
.bowerrc introduced bower to manage js dependencies 2013-12-13 17:45:57 +00:00
.codeclimate.yml tell CodeClimate to use ESLint 3 2017-01-03 21:53:43 +00:00
.dockerignore fix incorrect .dockerignore of translations/_core_en.js 2016-12-15 18:39:27 +00:00
.editorconfig Add EditorConfig configuration file to help maintain code style 2016-11-15 20:08:55 +00:00
.eslintignore Update eslint/airbnb-eslint-config 2017-01-18 18:05:09 +00:00
.eslintrc.common.js [eslint] Turn off class-methods-use-this rule 2017-01-16 21:29:11 +00:00
.eslintrc.js [eslint] add eslint-plugin-promise 2017-01-04 18:21:04 +00:00
.gitignore keep a separate lockfile for ruby 2.4 for now 2017-01-27 17:17:10 +00:00
.i18nignore bump rails 3 to github branch for ruby 2.2 compatibility 2015-02-18 22:55:20 +00:00
.i18nrc upgrade to node 6 2016-08-09 23:37:07 +00:00
.jshintrc make jslint settings more sane 2012-08-17 11:04:40 -06:00
.npmrc fix brand config previewing and skipping 2015-10-27 16:16:15 +00:00
.nvmrc upgrade to node 6 2016-08-09 23:37:07 +00:00
.rubocop.yml upgrade rubocop and rubocop-rspec to latest 2017-02-02 16:16:39 +00:00
.selinimumignore Revert and bring InstIcons into Canvas 2016-11-29 20:52:54 +00:00
.stylelintrc stylelint, refs SD-1603 2016-10-25 00:21:16 +00:00
.travis.yml more travis builds 2014-02-10 16:23:19 +00:00
CONTRIBUTING.md Update contributing guidelines with linter information 2017-01-23 16:24:52 +00:00
COPYRIGHT Initial commit. 2011-01-31 18:57:29 -07:00
Dockerfile docker-compose.yml v2 2016-11-15 17:06:37 +00:00
Gemfile remove rails 4.0 support 2016-10-25 17:17:22 +00:00
Guardfile upgrade guard and pin development gems 2017-01-03 22:05:03 +00:00
LICENSE Initial commit. 2011-01-31 18:57:29 -07:00
README.md Update README.md since Canvas is still modern 2016-12-15 03:18:28 +00:00
Rakefile remove dead parallelized specs task 2016-11-10 21:41:08 +00:00
bower.json use node_modules wherever possible 2016-11-01 15:14:52 +00:00
code_of_conduct.md contributor code of conduct 2014-12-23 18:13:59 +00:00
config.ru start adding rails 3.0 support 2013-03-22 19:08:40 +00:00
docker-compose.override.yml Add more volumes 2016-11-28 22:40:23 +00:00
docker-compose.yml docker-compose.yml v2 2016-11-15 17:06:37 +00:00
gulpfile.js Webpack: better handling of chunks and cdn stuff 2017-01-03 22:50:31 +00:00
issue_template.md Add issue_template.md for GitHub issues 2016-02-17 21:00:48 +00:00
karma.conf.js fix 404 errors with css in webpack tests 2017-02-02 17:13:40 +00:00
package.json Fix webpack build (update instructure-ui) 2017-01-26 17:27:19 +00:00
webpack.config.js don't pass frontend build files through babel 2016-11-08 20:29:29 +00:00
webpack.production.config.js Webpack: better handling of chunks and cdn stuff 2017-01-03 22:50:31 +00:00
webpack.test.config.js Add enzyme testing to Canvas 2017-01-04 20:21:36 +00:00

README.md

Canvas LMS

Canvas is a modern, open-source LMS developed and maintained by Instructure Inc. It is released under the AGPLv3 license for use by anyone interested in learning more about or using learning management systems.

Please see our main wiki page for more information

Installation

Detailed instructions for installation and configuration of Canvas are provided on our wiki.