canvas-lms/app/models
Brian Palmer 207efe7698 only include unpublishable in the json response when applicable
In other words, when the API caller can publish/unpublish the quiz

Also change the semantics of Quiz#has_student_submissions slightly, so
that we can do a simple count > 0 query, rather than loading all the
submissions just to determine it. The only difference in behavior is if
a user took the quiz and then their enrollment was dropped.

Change-Id: I2aa779d247b87a5f1775fc93baa74b6920045569
Reviewed-on: https://gerrit.instructure.com/26892
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-12-03 05:20:41 +00:00
..
broadcast_policies don't send "needs grading" notification for graded surveys 2013-11-21 18:14:44 +00:00
discussion_topic don't include ActionController::UrlWriter w/rails3 2013-10-29 15:50:39 +00:00
quiz_question Quiz question refactor / api implementation 2013-11-22 17:03:45 +00:00
quiz_statistics correctly calculate number of questions affected by multiple regrades 2013-11-04 15:00:51 +00:00
abstract_course.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
access_token.rb add push communication channel type 2013-11-21 21:38:45 +00:00
account.rb move draft state under feature flag umbrella 2013-11-26 20:43:49 +00:00
account_authorization_config.rb use the now-standard timeout_protection for ldap binding 2013-10-03 22:18:16 +00:00
account_notification.rb deprecate Setting.get_cached 2013-10-10 00:42:52 +00:00
account_report.rb show when an account report fails in the ui and api 2013-12-02 22:57:25 +00:00
account_user.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
alert.rb use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
alert_criterion.rb alerts, closes #4317 2011-08-24 10:19:44 -06:00
announcement.rb fix permissions on imported announcements. 2013-08-13 02:18:55 +00:00
appointment_group.rb use unicode sorting for ruby and db stuff 2013-10-02 21:38:03 +00:00
appointment_group_context.rb multiple contexts per appointment group 2012-04-30 15:30:03 -06:00
appointment_group_sub_context.rb multiple contexts per appointment group 2012-04-30 15:30:03 -06:00
assessment_question.rb Quiz question refactor / api implementation 2013-11-22 17:03:45 +00:00
assessment_question_bank.rb make randomization of quiz questions work better within quiz groups 2013-11-06 19:44:08 +00:00
assessment_question_bank_user.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
assessment_request.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
asset_user_access.rb More accurate Access Report scores for Quizzes 2013-11-26 23:05:01 +00:00
assignment.rb don't include assignment version_number in cache key 2013-12-03 00:53:37 +00:00
assignment_group.rb ensure neverdrop ids are strings 2013-10-24 19:01:56 +00:00
assignment_override.rb use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
assignment_override_student.rb arel-ify models 2013-04-01 18:42:38 +00:00
attachment.rb only do scribd docs on root attachments 2013-11-26 15:51:18 +00:00
attachment_association.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
authorization_code.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
big_blue_button_conference.rb fix BBB xml error on timed out conferences and rejoining as mod 2013-10-28 17:17:38 +00:00
bookmark_service.rb i18n Bookmark Service 2011-06-16 07:16:10 -06:00
calendar_event.rb fix all day calendar event importing 2013-11-08 18:10:00 +00:00
cloned_item.rb make sure links in assessment questions are correctly translated, fixes #6012 2011-10-21 08:36:34 -06:00
collaboration.rb improve collaboration/group query 2013-10-18 00:05:10 +00:00
collaborator.rb add groups to collaborators table, add api endpoint. 2013-01-04 20:18:04 -07:00
collection.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
collection_item.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
collection_item_data.rb get rspec 2 running with rails 3.0 2013-03-27 15:41:28 +00:00
collection_item_upvote.rb arel-ify models 2013-04-01 18:42:38 +00:00
communication_channel.rb add push communication channel type 2013-11-21 21:38:45 +00:00
content_export.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
content_migration.rb rubyzip 1.0.0 upgrade 2013-11-22 19:23:34 +00:00
content_participation.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
content_participation_count.rb deprecate Setting.get_cached 2013-10-10 00:42:52 +00:00
content_tag.rb sync quizzes content_tag when publishing/unpublishing 2013-12-02 16:58:12 +00:00
context.rb move draft state under feature flag umbrella 2013-11-26 20:43:49 +00:00
context_external_tool.rb fixed a bug in the sessionless launch api 2013-11-21 21:07:55 +00:00
context_module.rb draft state modules 2013-11-12 16:31:46 +00:00
context_module_item.rb change available_for? and locked_for? to be more consistent 2013-06-07 21:41:21 +00:00
context_module_progression.rb add framework for events to be triggered when a module is completed 2013-10-15 21:59:07 +00:00
context_module_sub_header.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
conversation.rb limit fake_arel caveats to rails2 2013-11-19 19:46:30 +00:00
conversation_batch.rb allow bulk messaging in new conversations 2013-09-24 00:29:53 +00:00
conversation_message.rb don't include ActionController::UrlWriter w/rails3 2013-10-29 15:50:39 +00:00
conversation_message_participant.rb add soft delete to conversation_message_participants 2013-08-08 16:00:51 +00:00
conversation_participant.rb add multi-select to new conversations 2013-11-08 19:28:34 +00:00
course.rb moves test student to end of csv gradebook file 2013-12-02 23:53:27 +00:00
course_account_association.rb optimize Account#/Course.update_account_associations a bit 2013-06-07 14:47:09 +00:00
course_import.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
course_profile.rb context profiles, refs CNVS-2650 2013-02-01 17:57:07 -07:00
course_section.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
crocodoc_document.rb optimize CrocodocDocument.update_process_states 2013-08-22 19:12:15 +00:00
delayed_message.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
delayed_notification.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
designer_enrollment.rb straighten out course designer permissions 2012-01-13 18:56:50 -07:00
developer_key.rb add push communication channel type 2013-11-21 21:38:45 +00:00
discussion_entry.rb rails3: errors_add_to_base was removed 2013-11-25 16:57:42 +00:00
discussion_entry_participant.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
discussion_topic.rb don't create 2 jobs for auto-locked delayed announcements 2013-11-26 20:58:10 +00:00
discussion_topic_participant.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
document_service.rb Initial commit. 2011-01-31 18:57:29 -07:00
enrollment.rb avoid excessive update-cached-due-date callbacks 2013-10-16 21:04:03 +00:00
enrollment_dates_override.rb term start/term end, rather than whenever 2011-09-13 15:20:15 -06:00
enrollment_term.rb avoid :conditions argument to find, count, etc. 2013-10-14 19:29:27 +00:00
eportfolio.rb record when a quiz or user gets deleted 2013-10-29 23:07:12 +00:00
eportfolio_category.rb improve error handling for ePortfolio section editing 2013-09-11 20:36:14 +00:00
eportfolio_entry.rb remove some egregious usages of Enumerable#select when a query will do 2013-05-31 22:11:15 +00:00
error_report.rb use CANVAS_RAILS2 for conditionals 2013-10-10 15:58:43 +00:00
etherpad_collaboration.rb don't re-calculate the etherpad url when a new user joins 2013-11-08 21:45:44 +00:00
external_feed.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
external_feed_entry.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
external_url.rb optimize AdheresToPolicy 2011-07-14 13:25:28 -06:00
favorite.rb arel-ify scopes 2013-04-01 21:57:16 +00:00
feature_flag.rb feature flags infrastructure and API 2013-11-19 20:50:03 +00:00
folder.rb record when a quiz or user gets deleted 2013-10-29 23:07:12 +00:00
google_docs_collaboration.rb move google docs domain restriction to feature flag 2013-11-27 15:37:01 +00:00
gradebook_upload.rb prepare for foreign keys refs #6895 2012-05-10 09:46:05 -06:00
grading_standard.rb use unicode sorting for ruby and db stuff 2013-10-02 21:38:03 +00:00
group.rb move draft state under feature flag umbrella 2013-11-26 20:43:49 +00:00
group_category.rb support for student organized groups in new ui, fixes CNVS-8210 2013-11-08 23:32:47 +00:00
group_membership.rb avoid excessive update-cached-due-date callbacks 2013-10-16 21:04:03 +00:00
ignore.rb arel-ify models 2013-04-01 18:42:38 +00:00
inbox_item.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
learning_outcome.rb remove unnecessary clone_for methods 2013-10-09 12:13:18 +00:00
learning_outcome_group.rb remove unnecessary clone_for methods 2013-10-09 12:13:18 +00:00
learning_outcome_result.rb simplify SimplyVersioned option storage and add callbacks 2013-04-20 13:20:29 +00:00
mailer.rb better handle varying number of parts for mailer 2013-11-14 03:27:57 +00:00
media_object.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
media_track.rb Allow uploading subtitle tracks to videos 2013-02-01 12:53:16 -07:00
message.rb don't include ActionController::UrlWriter w/rails3 2013-10-29 15:50:39 +00:00
migration_issue.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
notification.rb clean up sorting all over 2013-10-02 21:38:08 +00:00
notification_policy.rb limit fake_arel caveats to rails2 2013-11-19 19:46:30 +00:00
oauth_request.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
observer_enrollment.rb arel-ify models 2013-04-01 18:42:38 +00:00
open_object.rb simplify OpenStruct/OpenObject json serialization 2013-08-29 16:44:13 +00:00
page_comment.rb arel-ify scopes 2013-04-01 21:57:16 +00:00
page_view.rb add option for course grade change (log auditing) 2013-11-21 20:53:27 +00:00
plugin_setting.rb Revert "Revert "use the cached plugin settings to determine if enabled"" 2013-10-16 19:54:11 +00:00
profile.rb adds unlisted to the list of valid profile visibility values 2013-05-31 03:09:23 +00:00
progress.rb support tracking a delayed job in the Progress model 2013-07-10 14:11:48 +00:00
pseudonym.rb record when a quiz or user gets deleted 2013-10-29 23:07:12 +00:00
pseudonym_session.rb rails3 fixes 2013-06-26 20:22:26 +00:00
quiz.rb only include unpublishable in the json response when applicable 2013-12-03 05:20:41 +00:00
quiz_group.rb add input validation for quiz groups 2013-11-26 18:45:45 +00:00
quiz_question.rb Quiz question refactor / api implementation 2013-11-22 17:03:45 +00:00
quiz_question_regrade.rb add the ability to regrade a quiz 2013-08-19 17:29:26 +00:00
quiz_regrade.rb add the ability to regrade a quiz 2013-08-19 17:29:26 +00:00
quiz_regrade_run.rb add the ability to regrade a quiz 2013-08-19 17:29:26 +00:00
quiz_sortables.rb refactor and add api to quiz group reorder 2013-11-21 18:17:48 +00:00
quiz_statistics.rb only strand quiz_stats jobs per quiz 2013-06-05 17:22:07 +00:00
quiz_submission.rb Quiz question refactor / api implementation 2013-11-22 17:03:45 +00:00
quiz_submission_attempt.rb correctly calculate number of questions affected by multiple regrades 2013-11-04 15:00:51 +00:00
quiz_submission_history.rb correctly calculate number of questions affected by multiple regrades 2013-11-04 15:00:51 +00:00
quiz_submission_snapshot.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
report_snapshot.rb arel-ify scopes 2013-04-01 21:57:16 +00:00
role.rb record when a quiz or user gets deleted 2013-10-29 23:07:12 +00:00
role_override.rb add option for course grade change (log auditing) 2013-11-21 20:53:27 +00:00
rubric.rb added 255 character max title length to rubric in model 2013-12-02 23:52:22 +00:00
rubric_assessment.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
rubric_association.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
scribd_mime_type.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
session_persistence_token.rb fix session persistence tokens for out-of-shard users 2013-06-27 20:01:47 +00:00
setting.rb deprecate Setting.get_cached 2013-10-10 00:42:52 +00:00
sis_batch.rb detect failed SIS jobs 2013-10-15 21:57:56 +00:00
stream_item.rb limit fake_arel caveats to rails2 2013-11-19 19:46:30 +00:00
stream_item_instance.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
student_enrollment.rb Minor fixes to StudentEnrollment associations. 2012-05-04 16:46:43 -06:00
student_view_enrollment.rb student view; closes #6995 2012-04-03 14:11:07 -06:00
submission.rb exclude submission comments from new conversation badge 2013-11-23 00:22:33 +00:00
submission_comment.rb grades_summary: eliminate many comment/attachment/rubric queries 2013-10-25 22:09:45 +00:00
submission_comment_participant.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
submission_version.rb make data fixup resilient to missing submission rows 2013-11-11 23:31:36 +00:00
ta_enrollment.rb straighten out course designer permissions 2012-01-13 18:56:50 -07:00
tableless.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
teacher_enrollment.rb straighten out course designer permissions 2012-01-13 18:56:50 -07:00
thumbnail.rb update thumbnail attachment options like Attachment's 2013-03-26 18:46:14 +00:00
user.rb feature flags infrastructure and API 2013-11-19 20:50:03 +00:00
user_account_association.rb clean up user account associations 2013-01-31 10:41:55 -07:00
user_follow.rb use rails3 style validate/before_validation 2013-10-14 19:28:28 +00:00
user_note.rb record when a quiz or user gets deleted 2013-10-29 23:07:12 +00:00
user_observer.rb user co-enrollment backend work, closes #8588 2012-05-23 12:21:00 -06:00
user_profile.rb prevent text overflow for user_profile.title 2013-08-23 20:05:19 +00:00
user_profile_link.rb add data validation to user profile links 2012-09-24 15:38:26 -06:00
user_service.rb validate nullness in the db on a bunch of columns 2013-09-12 22:20:39 +00:00
web_conference.rb class_inheritable_accessor -> class_attribute 2013-10-29 17:53:35 +00:00
web_conference_participant.rb check all models for protecting attributes refs #3847 2011-05-25 17:38:50 -06:00
wiki.rb move draft state under feature flag umbrella 2013-11-26 20:43:49 +00:00
wiki_page.rb move draft state under feature flag umbrella 2013-11-26 20:43:49 +00:00
wimba_conference.rb handle wimba conference date parsing in ruby18/ruby19. 2013-02-08 12:43:19 -07:00
zip_file_import.rb use the birth shard so that the default shard can be changed 2013-05-07 15:44:17 +00:00