canvas-lms/app/helpers/assignments_helper.rb

52 lines
1.9 KiB
Ruby
Raw Normal View History

2011-02-01 09:57:29 +08:00
#
correctly show completion icons on peer review listings Because of concerns with a potential race condition on using just the incomplete peer review count we've also added the total count of assigned reviews to the cache key. These two additions still allow us to take advantage of caching yielding a 90% performance improvement against a hot cache locally. These numbers may not translate perfectly to production given that this page may have frequent cache misses. This is something we should probably take a look at in the logs once this is in beta/production. fixes CNVS-7523 Test Plan: - As an instructor build a class with at least 2 students - Add an assignment to the class with peer review enabled - Assign peer reviewers manually - These should start marked as incomplete with a yellow icon - As the first student navigate to the assignment and submit it - As the second student navigate to the assignment - In the sidebar this student should see that they have an incomplete review, indicated by the yellow icon - Complete the review and view the assignment again - The review should indicate that it is complete with a green checkmark - As the teacher view the peer assessments page - The review you previously completed should show as completed using the same green checkmark. Change-Id: I8b71fd8f25c71b8031ab74b57d280c98add2c14e Reviewed-on: https://gerrit.instructure.com/34420 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Mike Nomitch <mnomitch@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Steven Shepherd <sshepherd@instructure.com> Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-05-07 03:44:20 +08:00
# Copyright (C) 2011 - 2014 Instructure, Inc.
2011-02-01 09:57:29 +08:00
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
module AssignmentsHelper
correctly show completion icons on peer review listings Because of concerns with a potential race condition on using just the incomplete peer review count we've also added the total count of assigned reviews to the cache key. These two additions still allow us to take advantage of caching yielding a 90% performance improvement against a hot cache locally. These numbers may not translate perfectly to production given that this page may have frequent cache misses. This is something we should probably take a look at in the logs once this is in beta/production. fixes CNVS-7523 Test Plan: - As an instructor build a class with at least 2 students - Add an assignment to the class with peer review enabled - Assign peer reviewers manually - These should start marked as incomplete with a yellow icon - As the first student navigate to the assignment and submit it - As the second student navigate to the assignment - In the sidebar this student should see that they have an incomplete review, indicated by the yellow icon - Complete the review and view the assignment again - The review should indicate that it is complete with a green checkmark - As the teacher view the peer assessments page - The review you previously completed should show as completed using the same green checkmark. Change-Id: I8b71fd8f25c71b8031ab74b57d280c98add2c14e Reviewed-on: https://gerrit.instructure.com/34420 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Mike Nomitch <mnomitch@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Steven Shepherd <sshepherd@instructure.com> Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-05-07 03:44:20 +08:00
PEER_REVIEW_LINK_OPTIONS = {
completed: {
class: 'pass',
title: I18n.t('tooltips.finished', 'finished'),
},
in_progress: {
class: 'warning',
title: I18n.t('tooltips.incomplete', 'incomplete'),
}
}
def multiple_due_dates(assignment)
# can use this method as the single source of rendering multiple due dates
# for now, just text, but eventually, a bubble/dialog/link/etc, rendering
# the information contained in the varied_due_date parameter
I18n.t '#assignments.multiple_due_dates', 'Multiple Due Dates'
end
correctly show completion icons on peer review listings Because of concerns with a potential race condition on using just the incomplete peer review count we've also added the total count of assigned reviews to the cache key. These two additions still allow us to take advantage of caching yielding a 90% performance improvement against a hot cache locally. These numbers may not translate perfectly to production given that this page may have frequent cache misses. This is something we should probably take a look at in the logs once this is in beta/production. fixes CNVS-7523 Test Plan: - As an instructor build a class with at least 2 students - Add an assignment to the class with peer review enabled - Assign peer reviewers manually - These should start marked as incomplete with a yellow icon - As the first student navigate to the assignment and submit it - As the second student navigate to the assignment - In the sidebar this student should see that they have an incomplete review, indicated by the yellow icon - Complete the review and view the assignment again - The review should indicate that it is complete with a green checkmark - As the teacher view the peer assessments page - The review you previously completed should show as completed using the same green checkmark. Change-Id: I8b71fd8f25c71b8031ab74b57d280c98add2c14e Reviewed-on: https://gerrit.instructure.com/34420 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Mike Nomitch <mnomitch@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Steven Shepherd <sshepherd@instructure.com> Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-05-07 03:44:20 +08:00
def student_peer_review_link_for(context, assignment, assessment)
link_options = assessment.completed? ? PEER_REVIEW_LINK_OPTIONS[:completed] : PEER_REVIEW_LINK_OPTIONS[:in_progress]
link_to assessment.asset_user_name, context_url(context, :context_assignment_submission_url, assignment.id, assessment.asset.user_id), link_options
end
def due_at(assignment, user, format='datetime')
if assignment.multiple_due_dates_apply_to?(user)
multiple_due_dates(assignment)
else
assignment = assignment.overridden_for(user)
send("#{format}_string", assignment.due_at, :short)
end
end
2011-02-01 09:57:29 +08:00
end