dots and new lines
test plan - specs should pass Change-Id: Iafc7c9b8ca64f32568e658b600e19c2e6f9045ca Reviewed-on: https://gerrit.instructure.com/138026 Tested-by: Jenkins Reviewed-by: Cody Cutrer <cody@instructure.com> Product-Review: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
parent
8e573f1ed7
commit
b5de0458d9
|
@ -780,21 +780,21 @@ class ApplicationController < ActionController::Base
|
|||
# view them.
|
||||
course_ids = only_contexts.select { |c| c.first == "Course" }.map(&:last)
|
||||
unless course_ids.empty?
|
||||
courses = Course
|
||||
.shard(opts[:cross_shard] ? @context.in_region_associated_shards : Shard.current)
|
||||
.joins(enrollments: :enrollment_state)
|
||||
.merge(enrollment_scope)
|
||||
.where(id: course_ids)
|
||||
courses = Course.
|
||||
shard(opts[:cross_shard] ? @context.in_region_associated_shards : Shard.current).
|
||||
joins(enrollments: :enrollment_state).
|
||||
merge(enrollment_scope).
|
||||
where(id: course_ids)
|
||||
end
|
||||
if include_groups
|
||||
group_ids = only_contexts.select { |c| c.first == "Group" }.map(&:last)
|
||||
include_groups = !group_ids.empty?
|
||||
end
|
||||
else
|
||||
courses = Course
|
||||
.shard(opts[:cross_shard] ? @context.in_region_associated_shards : Shard.current)
|
||||
.joins(enrollments: :enrollment_state)
|
||||
.merge(enrollment_scope)
|
||||
courses = Course.
|
||||
shard(opts[:cross_shard] ? @context.in_region_associated_shards : Shard.current).
|
||||
joins(enrollments: :enrollment_state).
|
||||
merge(enrollment_scope)
|
||||
end
|
||||
|
||||
groups = []
|
||||
|
|
|
@ -618,8 +618,8 @@ class AssignmentsApiController < ApplicationController
|
|||
|
||||
new_assignment.insert_at(old_assignment.position + 1)
|
||||
new_assignment.save!
|
||||
positions_in_group = Assignment.active.where(assignment_group_id: old_assignment.assignment_group_id)
|
||||
.pluck("id", "position")
|
||||
positions_in_group = Assignment.active.where(assignment_group_id: old_assignment.assignment_group_id).
|
||||
pluck("id", "position")
|
||||
positions_hash = {}
|
||||
positions_in_group.each do |id_pos_pair|
|
||||
positions_hash[id_pos_pair[0]] = id_pos_pair[1]
|
||||
|
@ -742,8 +742,8 @@ class AssignmentsApiController < ApplicationController
|
|||
# All dates associated with the assignment, if applicable
|
||||
# @returns Assignment
|
||||
def show
|
||||
@assignment = @context.active_assignments.preload(:assignment_group, :rubric_association, :rubric)
|
||||
.api_id(params[:id])
|
||||
@assignment = @context.active_assignments.preload(:assignment_group, :rubric_association, :rubric).
|
||||
api_id(params[:id])
|
||||
if authorized_action(@assignment, @current_user, :read)
|
||||
return render_unauthorized_action unless @assignment.visible_to_user?(@current_user)
|
||||
|
||||
|
|
|
@ -349,8 +349,8 @@ class CalendarEventsApiController < ApplicationController
|
|||
mark_submitted_assignments(user, events)
|
||||
includes = Array(params[:include])
|
||||
if includes.include?("submission")
|
||||
submissions = Submission.active.where(assignment_id: events, user_id: user)
|
||||
.group_by(&:assignment_id)
|
||||
submissions = Submission.active.where(assignment_id: events, user_id: user).
|
||||
group_by(&:assignment_id)
|
||||
end
|
||||
# preload data used by assignment_json
|
||||
ActiveRecord::Associations::Preloader.new.preload(events, :discussion_topic)
|
||||
|
|
|
@ -713,16 +713,15 @@ class ConversationsController < ApplicationController
|
|||
return render_error('conversation_id', 'required') unless params['conversation_id']
|
||||
|
||||
Conversation.find(params['conversation_id']).shard.activate do
|
||||
cmp = ConversationMessageParticipant
|
||||
.where(:user_id => params['user_id'])
|
||||
.where(:conversation_message_id => params['message_id'])
|
||||
cmp = ConversationMessageParticipant.
|
||||
where(:user_id => params['user_id']).
|
||||
where(:conversation_message_id => params['message_id'])
|
||||
|
||||
cmp.update_all(:workflow_state => 'active', :deleted_at => nil)
|
||||
|
||||
participant = ConversationParticipant
|
||||
.where(:conversation_id => params['conversation_id'])
|
||||
.where(:user_id => params['user_id'])
|
||||
.first()
|
||||
participant = ConversationParticipant.
|
||||
where(:conversation_id => params['conversation_id']).
|
||||
where(:user_id => params['user_id']).first
|
||||
messages = participant.messages
|
||||
|
||||
participant.message_count = messages.count(:id)
|
||||
|
|
|
@ -87,9 +87,9 @@ class GradingPeriodsController < ApplicationController
|
|||
paginated_grading_periods, meta = paginate_for(grading_periods)
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render json: serialize_json_api(paginated_grading_periods, meta)
|
||||
.merge(index_permissions)
|
||||
.merge(grading_periods_read_only: read_only)
|
||||
render json: serialize_json_api(paginated_grading_periods, meta).
|
||||
merge(index_permissions).
|
||||
merge(grading_periods_read_only: read_only)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,9 +78,9 @@ class LoginController < ApplicationController
|
|||
end
|
||||
|
||||
unless flash[:delegated_message]
|
||||
return redirect_to url_for({ controller: "login/#{auth_type}", action: :new }
|
||||
.merge(params.permit(:id).to_unsafe_h)
|
||||
.merge(params.permit(pseudonym_session: :unique_id).to_unsafe_h))
|
||||
return redirect_to url_for({controller: "login/#{auth_type}", action: :new}.
|
||||
merge(params.permit(:id).to_unsafe_h).
|
||||
merge(params.permit(pseudonym_session: :unique_id).to_unsafe_h))
|
||||
end
|
||||
|
||||
# we had an error from an SSO - we need to show it
|
||||
|
|
|
@ -430,9 +430,9 @@ class OutcomeResultsController < ApplicationController
|
|||
# context and outcome id in order to ensure we get the correct result
|
||||
# from the query without rendering the reject! check moot
|
||||
|
||||
@outcomes = ContentTag.learning_outcome_links.active.joins(:learning_outcome_content)
|
||||
.where(content_id: outcome_ids, context_type: @context.class_name, context_id: @context.id)
|
||||
.to_a.uniq{|tag| [tag.context, tag.content_id]}.map(&:learning_outcome_content)
|
||||
@outcomes = ContentTag.learning_outcome_links.active.joins(:learning_outcome_content).
|
||||
where(content_id: outcome_ids, context_type: @context.class_name, context_id: @context.id).
|
||||
to_a.uniq{|tag| [tag.context, tag.content_id]}.map(&:learning_outcome_content)
|
||||
reject! "can only include id's of outcomes in the outcome context" if @outcomes.count != outcome_ids.count
|
||||
else
|
||||
@outcome_links = []
|
||||
|
|
|
@ -209,11 +209,10 @@ class OutcomesController < ApplicationController
|
|||
if @asset.is_a?(Quizzes::Quiz) && @result.alignment && @result.alignment.content_type == 'AssessmentQuestionBank'
|
||||
# anchor to first question in aligned bank
|
||||
question_bank_id = @result.alignment.content_id
|
||||
first_aligned_question = Quizzes::QuizQuestion.where(quiz_id: @asset.id)
|
||||
.joins(:assessment_question)
|
||||
.where(assessment_questions: { assessment_question_bank_id: question_bank_id })
|
||||
.order(:position)
|
||||
.first
|
||||
first_aligned_question = Quizzes::QuizQuestion.where(quiz_id: @asset.id).
|
||||
joins(:assessment_question).
|
||||
where(assessment_questions: { assessment_question_bank_id: question_bank_id }).
|
||||
order(:position).first
|
||||
anchor = first_aligned_question ? "question_#{first_aligned_question.id}" : nil
|
||||
elsif @asset.is_a? AssessmentQuestion
|
||||
question = @submission.quiz_data.detect{|q| q['assessment_question_id'] == @asset.data[:id] }
|
||||
|
|
|
@ -217,15 +217,15 @@ class ProvisionalGradesController < ApplicationController
|
|||
grades_to_publish = graded_submissions.map do |submission|
|
||||
if (selection = selections[submission.user_id])
|
||||
# student in moderation: choose the selected provisional grade
|
||||
selected_provisional_grade = submission.provisional_grades
|
||||
.detect { |pg| pg.id == selection.selected_provisional_grade_id }
|
||||
selected_provisional_grade = submission.provisional_grades.
|
||||
detect { |pg| pg.id == selection.selected_provisional_grade_id }
|
||||
end
|
||||
|
||||
# either the student is not in moderation, or not all provisional grades were entered
|
||||
# choose the first one with a grade (there should only be one)
|
||||
unless selected_provisional_grade
|
||||
provisional_grades = submission.provisional_grades
|
||||
.select { |pg| pg.graded_at.present? }
|
||||
provisional_grades = submission.provisional_grades.
|
||||
select { |pg| pg.graded_at.present? }
|
||||
selected_provisional_grade = provisional_grades.first if provisional_grades.count == 1
|
||||
end
|
||||
|
||||
|
|
|
@ -223,8 +223,8 @@ class SubmissionsApiController < ApplicationController
|
|||
@assignment.representatives(@current_user).map(&:id)
|
||||
else
|
||||
@context.apply_enrollment_visibility(@context.student_enrollments,
|
||||
@current_user, section_ids)
|
||||
.pluck(:user_id)
|
||||
@current_user, section_ids).
|
||||
pluck(:user_id)
|
||||
end
|
||||
submissions = @assignment.submissions.where(user_id: student_ids).preload(:originality_reports)
|
||||
submissions = submissions.preload(:quiz_submission) if @assignment.quiz?
|
||||
|
|
|
@ -54,8 +54,8 @@ module Types
|
|||
nil
|
||||
end
|
||||
|
||||
Loaders::AssociationLoader.for(Enrollment, [:scores, :user, :course])
|
||||
.load(enrollment).then do
|
||||
Loaders::AssociationLoader.for(Enrollment, [:scores, :user, :course]).
|
||||
load(enrollment).then do
|
||||
if grading_period_id = args[:gradingPeriodId]
|
||||
grades_resolver.call(grading_period_id)
|
||||
else
|
||||
|
|
|
@ -465,11 +465,11 @@ class Account < ActiveRecord::Base
|
|||
else
|
||||
shard.activate do
|
||||
if opts[:include_crosslisted_courses]
|
||||
Course.where("EXISTS (?)", CourseAccountAssociation.where(account_id: self)
|
||||
.where("course_id=courses.id"))
|
||||
Course.where("EXISTS (?)", CourseAccountAssociation.where(account_id: self).
|
||||
where("course_id=courses.id"))
|
||||
else
|
||||
Course.where("EXISTS (?)", CourseAccountAssociation.where(account_id: self, course_section_id: nil)
|
||||
.where("course_id=courses.id"))
|
||||
Course.where("EXISTS (?)", CourseAccountAssociation.where(account_id: self, course_section_id: nil).
|
||||
where("course_id=courses.id"))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1803,9 +1803,9 @@ class Assignment < ActiveRecord::Base
|
|||
[]
|
||||
end
|
||||
users_with_vericite_data = if vericite_enabled?
|
||||
submissions
|
||||
.reject { |s| s.turnitin_data.blank? }
|
||||
.map(&:user)
|
||||
submissions.
|
||||
reject {|s| s.turnitin_data.blank?}.
|
||||
map(&:user)
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
|
|
@ -31,8 +31,7 @@ class CommunicationChannel
|
|||
end
|
||||
|
||||
def matching_channels(for_report: false)
|
||||
ccs = CommunicationChannel.unretired
|
||||
.where(user_id: User.of_account(account))
|
||||
ccs = CommunicationChannel.unretired.where(user_id: User.of_account(account))
|
||||
|
||||
# Limit to self.class.bulk_limit, or REPORT_LIMIT if it's less and for_report is true
|
||||
ccs = ccs.limit([(REPORT_LIMIT if for_report), self.class.bulk_limit].compact.min)
|
||||
|
|
|
@ -291,13 +291,13 @@ module ConditionalRelease
|
|||
return [] unless student.present?
|
||||
Rails.cache.fetch(submissions_cache_key(student), force: force) do
|
||||
keys = [:id, :assignment_id, :score, "assignments.points_possible"]
|
||||
context.submissions
|
||||
.for_user(student)
|
||||
.in_workflow_state(:graded)
|
||||
.where(assignments: { muted: false })
|
||||
.eager_load(:assignment)
|
||||
.pluck(*keys)
|
||||
.map do |values|
|
||||
context.submissions.
|
||||
for_user(student).
|
||||
in_workflow_state(:graded).
|
||||
where(assignments: {muted: false}).
|
||||
eager_load(:assignment).
|
||||
pluck(*keys).
|
||||
map do |values|
|
||||
submission = Hash[keys.zip(values)]
|
||||
submission[:points_possible] = submission.delete("assignments.points_possible")
|
||||
submission
|
||||
|
|
|
@ -40,11 +40,7 @@ class ConversationMessageParticipant < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.query_deleted(user_id, options={})
|
||||
query = self
|
||||
.deleted
|
||||
.eager_load(:conversation_message)
|
||||
.where(:user_id => user_id)
|
||||
.order(deleted_at: :desc)
|
||||
query = self.deleted.eager_load(:conversation_message).where(user_id: user_id).order(deleted_at: :desc)
|
||||
|
||||
query = query.where('conversation_messages.conversation_id = ?', options['conversation_id']) if options['conversation_id']
|
||||
query = query.where('conversation_message_participants.deleted_at < ?', options['deleted_before']) if options['deleted_before']
|
||||
|
|
|
@ -92,9 +92,9 @@ class CourseProgress
|
|||
def requirements_completed
|
||||
# find the list of requirements that have been recorded as met for this module, then
|
||||
# select only those requirements that are current, and filter out any duplicates
|
||||
@_requirements_completed ||= module_progressions.flat_map { |cmp| cmp.requirements_met }
|
||||
.select { |req| requirements.include?(req) }
|
||||
.uniq
|
||||
@_requirements_completed ||= module_progressions.flat_map { |cmp| cmp.requirements_met }.
|
||||
select { |req| requirements.include?(req) }.
|
||||
uniq
|
||||
end
|
||||
|
||||
def requirement_completed_count
|
||||
|
|
|
@ -1341,10 +1341,8 @@ class Enrollment < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def update_assignment_overrides_if_needed
|
||||
assignment_scope = Assignment
|
||||
.where(context_id: self.course_id, context_type: 'Course')
|
||||
override_scope = AssignmentOverrideStudent
|
||||
.where(user_id: self.user_id)
|
||||
assignment_scope = Assignment.where(context_id: self.course_id, context_type: 'Course')
|
||||
override_scope = AssignmentOverrideStudent.where(user_id: self.user_id)
|
||||
|
||||
if being_deleted? && !enrollments_exist_for_user_in_course?
|
||||
return unless (assignment_ids = assignment_scope.pluck(:id)).any?
|
||||
|
|
|
@ -91,11 +91,11 @@ module Lti
|
|||
def current_course_observee_lti_context_ids
|
||||
return [] unless @canvas_context.is_a?(Course)
|
||||
|
||||
@current_course_observee_lti_context_ids ||= @canvas_user.observer_enrollments
|
||||
.current
|
||||
.where(course_id: @canvas_context)
|
||||
.preload(:associated_user)
|
||||
.map { |e| e.try(:associated_user).try(:lti_context_id) }.compact
|
||||
@current_course_observee_lti_context_ids ||= @canvas_user.observer_enrollments.
|
||||
current.
|
||||
where(course_id: @canvas_context).
|
||||
preload(:associated_user).
|
||||
map { |e| e.try(:associated_user).try(:lti_context_id) }.compact
|
||||
end
|
||||
|
||||
def current_account_enrollments()
|
||||
|
|
|
@ -56,8 +56,8 @@ class ObserverEnrollment < Enrollment
|
|||
def self.observed_students(context, current_user)
|
||||
RequestCache.cache(:observed_students, context, current_user) do
|
||||
context.shard.activate do
|
||||
associated_user_ids = context.observer_enrollments.where(user_id: current_user)
|
||||
.where("associated_user_id IS NOT NULL").select(:associated_user_id)
|
||||
associated_user_ids = context.observer_enrollments.where(user_id: current_user).
|
||||
where("associated_user_id IS NOT NULL").select(:associated_user_id)
|
||||
context.student_enrollments.
|
||||
where(user_id: associated_user_ids).group_by(&:user)
|
||||
end
|
||||
|
|
|
@ -1289,8 +1289,8 @@ class Quizzes::Quiz < ActiveRecord::Base
|
|||
|
||||
def questions_regraded_since(created_at)
|
||||
question_regrades = Set.new
|
||||
quiz_regrades.where("quiz_regrades.created_at > ? AND quiz_question_regrades.regrade_option != 'disabled'", created_at)
|
||||
.eager_load(:quiz_question_regrades).each do |regrade|
|
||||
quiz_regrades.where("quiz_regrades.created_at > ? AND quiz_question_regrades.regrade_option != 'disabled'", created_at).
|
||||
eager_load(:quiz_question_regrades).each do |regrade|
|
||||
ids = regrade.quiz_question_regrades.map { |qqr| qqr.quiz_question_id }
|
||||
question_regrades.merge(ids)
|
||||
end
|
||||
|
|
|
@ -3009,14 +3009,15 @@ class User < ActiveRecord::Base
|
|||
if for_course
|
||||
parent_folder = self.submissions_folder
|
||||
Folder.unique_constraint_retry do
|
||||
self.folders.where(parent_folder_id: parent_folder, submission_context_code: for_course.asset_string)
|
||||
.first_or_create!(name: for_course.name)
|
||||
self.folders.where(parent_folder_id: parent_folder, submission_context_code: for_course.asset_string).
|
||||
first_or_create!(name: for_course.name)
|
||||
end
|
||||
else
|
||||
return @submissions_folder if @submissions_folder
|
||||
Folder.unique_constraint_retry do
|
||||
@submissions_folder = self.folders.where(parent_folder_id: Folder.root_folders(self).first, submission_context_code: 'root')
|
||||
.first_or_create!(name: I18n.t('Submissions', locale: self.locale))
|
||||
@submissions_folder = self.folders.where(parent_folder_id: Folder.root_folders(self).first,
|
||||
submission_context_code: 'root').
|
||||
first_or_create!(name: I18n.t('Submissions', locale: self.locale))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,10 +130,10 @@
|
|||
<td><%= f.blabel :account_id, :en => "Account" %></td>
|
||||
<td>
|
||||
<%
|
||||
accounts = Account.root_accounts
|
||||
.active
|
||||
.map { |a| [(a.name || t("Unnamed Account (%{id})", id: a.id)), a.id] }
|
||||
.sort_by(&:first)
|
||||
accounts = Account.root_accounts.
|
||||
active.
|
||||
map { |a| [(a.name || t("Unnamed Account (%{id})", id: a.id)), a.id] }.
|
||||
sort_by(&:first)
|
||||
%>
|
||||
<%= f.select :account_id, accounts, {:selected => @domain_root_account.id}, :class => "account_id_select" %>
|
||||
</td>
|
||||
|
|
12
lib/api.rb
12
lib/api.rb
|
@ -53,12 +53,12 @@ module Api
|
|||
@domain_root_account.default_enrollment_term
|
||||
when 'current'
|
||||
if !current_term
|
||||
current_terms = @domain_root_account
|
||||
.enrollment_terms
|
||||
.active
|
||||
.where("(start_at<=? OR start_at IS NULL) AND (end_at >=? OR end_at IS NULL) AND NOT (start_at IS NULL AND end_at IS NULL)", Time.now.utc, Time.now.utc)
|
||||
.limit(2)
|
||||
.to_a
|
||||
current_terms = @domain_root_account.
|
||||
enrollment_terms.
|
||||
active.
|
||||
where("(start_at<=? OR start_at IS NULL) AND (end_at >=? OR end_at IS NULL) AND NOT (start_at IS NULL AND end_at IS NULL)", Time.now.utc, Time.now.utc).
|
||||
limit(2).
|
||||
to_a
|
||||
current_term = current_terms.length == 1 ? current_terms.first : :nil
|
||||
end
|
||||
current_term == :nil ? nil : current_term
|
||||
|
|
|
@ -52,9 +52,9 @@ module Canvas
|
|||
request_context_id: @rci,
|
||||
request_method: @req.request_method_symbol,
|
||||
format: @req.format,
|
||||
}.merge(self.class.useful_http_env_stuff_from_request(@req))
|
||||
.merge(self.class.useful_http_headers(@req))
|
||||
.merge(@canvas_error_info)
|
||||
}.merge(self.class.useful_http_env_stuff_from_request(@req)).
|
||||
merge(self.class.useful_http_headers(@req)).
|
||||
merge(@canvas_error_info)
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -115,18 +115,16 @@ DataFixup::FixCorruptAssessmentQuestionsFromCnvs19292 = Struct.new(:question_typ
|
|||
"assessment_questions.question_data LIKE '%#{qt}%'"
|
||||
end.join(" or ")
|
||||
|
||||
query = AssessmentQuestion
|
||||
.joins(:assessment_question_bank => {:quiz_groups => :quiz})
|
||||
.joins("INNER JOIN #{Quizzes::QuizQuestion.quoted_table_name}
|
||||
ON quiz_questions.assessment_question_id = assessment_questions.id
|
||||
AND quiz_questions.quiz_id = quizzes.id
|
||||
")
|
||||
.where("quiz_questions.updated_at > assessment_questions.updated_at")
|
||||
.where(question_type_queries)
|
||||
query = AssessmentQuestion.
|
||||
joins(:assessment_question_bank => {:quiz_groups => :quiz}).
|
||||
joins("INNER JOIN #{Quizzes::QuizQuestion.quoted_table_name}
|
||||
ON quiz_questions.assessment_question_id = assessment_questions.id
|
||||
AND quiz_questions.quiz_id = quizzes.id").
|
||||
where("quiz_questions.updated_at > assessment_questions.updated_at").
|
||||
where(question_type_queries)
|
||||
|
||||
if bug_start_date && bug_end_date
|
||||
query = query
|
||||
.where(quiz_questions: {updated_at: bug_start_date..bug_end_date})
|
||||
query = query.where(quiz_questions: {updated_at: bug_start_date..bug_end_date})
|
||||
end
|
||||
|
||||
Shackles.activate(:slave) do
|
||||
|
|
|
@ -170,9 +170,9 @@ class GradebookImporter
|
|||
@students.each do |student|
|
||||
student.gradebook_importer_submissions.each do |submission|
|
||||
submission_assignment_id = submission.fetch('assignment_id').to_i
|
||||
assignment = original_submissions_by_student
|
||||
.fetch(student.id, {})
|
||||
.fetch(submission_assignment_id, {})
|
||||
assignment = original_submissions_by_student.
|
||||
fetch(student.id, {}).
|
||||
fetch(submission_assignment_id, {})
|
||||
submission['original_grade'] = assignment.fetch(:score, nil)
|
||||
submission['gradeable'] = assignment.fetch(:gradable, nil)
|
||||
|
||||
|
|
|
@ -42,10 +42,10 @@ module Lti
|
|||
end
|
||||
|
||||
def groups
|
||||
@groups ||= @context.groups.active
|
||||
.order(:id)
|
||||
.offset(@page * @per_page)
|
||||
.limit(@per_page + 1)
|
||||
@groups ||= @context.groups.active.
|
||||
order(:id).
|
||||
offset(@page * @per_page).
|
||||
limit(@per_page + 1)
|
||||
end
|
||||
|
||||
def generate_member(group)
|
||||
|
|
|
@ -30,10 +30,10 @@ module Lti
|
|||
private
|
||||
|
||||
def users
|
||||
@users ||= user_scope
|
||||
.preload(:communication_channels, :not_ended_enrollments)
|
||||
.offset(@page * @per_page)
|
||||
.limit(@per_page + 1)
|
||||
@users ||= user_scope.
|
||||
preload(:communication_channels, :not_ended_enrollments).
|
||||
offset(@page * @per_page).
|
||||
limit(@per_page + 1)
|
||||
end
|
||||
|
||||
def user_scope
|
||||
|
|
|
@ -30,10 +30,10 @@ module Lti
|
|||
private
|
||||
|
||||
def users
|
||||
@users ||= user_scope
|
||||
.preload(:communication_channels)
|
||||
.offset(@page * @per_page)
|
||||
.limit(@per_page + 1)
|
||||
@users ||= user_scope.
|
||||
preload(:communication_channels).
|
||||
offset(@page * @per_page).
|
||||
limit(@per_page + 1)
|
||||
end
|
||||
|
||||
def user_scope
|
||||
|
|
|
@ -406,8 +406,8 @@ module Lti
|
|||
# http://example.url/path.css
|
||||
# ```
|
||||
register_expansion 'Canvas.css.common', [],
|
||||
-> { URI.parse(@request.url)
|
||||
.merge(@controller.view_context.stylesheet_path(@controller.css_url_for(:common))).to_s },
|
||||
-> { URI.parse(@request.url).
|
||||
merge(@controller.view_context.stylesheet_path(@controller.css_url_for(:common))).to_s },
|
||||
CONTROLLER_GUARD
|
||||
|
||||
# returns the shard id for the current context.
|
||||
|
|
|
@ -108,11 +108,11 @@ module SupportHelpers
|
|||
# By selecting only the id, we delay the full load until we're
|
||||
# ready to actually work on the assignment. Lots of little
|
||||
# loads than one giant one.
|
||||
Assignment.joins(:submissions)
|
||||
.where(updated_field.gt(@after_time))
|
||||
.where(updated_field.lt(@buffer_time))
|
||||
.where("submissions.#{like_error}")
|
||||
.distinct.pluck(:id)
|
||||
Assignment.joins(:submissions).
|
||||
where(updated_field.gt(@after_time)).
|
||||
where(updated_field.lt(@buffer_time)).
|
||||
where("submissions.#{like_error}").
|
||||
distinct.pluck(:id)
|
||||
end
|
||||
|
||||
def object_type
|
||||
|
@ -175,9 +175,9 @@ module SupportHelpers
|
|||
# Non-broken sumissions CAN have turnitin_data that has the
|
||||
# word error in them that aren't a top level error that we're
|
||||
# looking for. There aren't a lot, but we'll select them out here.
|
||||
@assignment.submissions.where(updated_field.gt(@after_time))
|
||||
.where(updated_field.lt(@buffer_time))
|
||||
.where(like_error).select { |s| is_bad_submission?(s) }
|
||||
@assignment.submissions.where(updated_field.gt(@after_time)).
|
||||
where(updated_field.lt(@buffer_time)).
|
||||
where(like_error).select { |s| is_bad_submission?(s) }
|
||||
end
|
||||
|
||||
def is_bad_submission?(s)
|
||||
|
@ -274,18 +274,18 @@ module SupportHelpers
|
|||
end
|
||||
|
||||
def load_broken_objects
|
||||
Submission.where(updated_field.gt(@after_time))
|
||||
.where(updated_field.lt(@buffer_time))
|
||||
.where(like_error)
|
||||
.pluck(:id)
|
||||
Submission.where(updated_field.gt(@after_time)).
|
||||
where(updated_field.lt(@buffer_time)).
|
||||
where(like_error).
|
||||
pluck(:id)
|
||||
end
|
||||
|
||||
def stuck_with_object_ids
|
||||
# These should be able to just have "check status" called on them.
|
||||
Submission.where(updated_field.gt(@after_time))
|
||||
.where(updated_field.lt(@buffer_time))
|
||||
.where("turnitin_data LIKE '--- \n:last_processed_attempt: _\nattachment_________: \n :status: pending\n :object_id: \"_________\"\n'")
|
||||
.pluck(:id)
|
||||
Submission.where(updated_field.gt(@after_time)).
|
||||
where(updated_field.lt(@buffer_time)).
|
||||
where("turnitin_data LIKE '--- \n:last_processed_attempt: _\nattachment_________: \n :status: pending\n :object_id: \"_________\"\n'").
|
||||
pluck(:id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -248,10 +248,10 @@ describe EnrollmentTerm do
|
|||
end
|
||||
|
||||
def term_ids_for_scope(scope)
|
||||
Array.wrap(@root_account
|
||||
.enrollment_terms
|
||||
.send(scope)
|
||||
.pluck(:id)).sort
|
||||
Array.wrap(@root_account.
|
||||
enrollment_terms.
|
||||
send(scope).
|
||||
pluck(:id)).sort
|
||||
end
|
||||
|
||||
def validate_scope(scope, expected_scopes = nil, include_default: false)
|
||||
|
|
|
@ -285,8 +285,8 @@ module Helpers
|
|||
assert_status(401)
|
||||
else
|
||||
# Certain responses require more privileges than the current user has (ie site admin)
|
||||
expect(response).to redirect_to(login_url)
|
||||
.or redirect_to(root_url)
|
||||
expect(response).to redirect_to(login_url).
|
||||
or redirect_to(root_url)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue