forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit gives teachers the ability to regrade quizzes by using different options per quiz question: * Current Correct Only * Full Credit (regardless of answer choice) * Previous and Current Correct * No Point change (for updating the display of a question) Test Plan: You'll want to run through each question regrade option making sure scores change appropriately. "I seldom end up where I wanted to go, but almost always end up where I need to be." - Douglas Adams Change-Id: I9dbb88154cd3ac630bf59dbf3e997a87f75649dc Reviewed-on: https://gerrit.instructure.com/22018 Tested-by: Jenkins <[email protected]> Reviewed-by: Derek DeVries <[email protected]> QA-Review: Myller de Araujo <[email protected]> Product-Review: Stanley Stuart <[email protected]>
- Loading branch information
Stanley Stuart
committed
Aug 19, 2013
1 parent
85236b9
commit 9b76539
Showing
53 changed files
with
1,769 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<% define_content :link do %> | ||
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.quiz.context) %>/<%= polymorphic_path([asset.quiz.context,asset.quiz]) %> | ||
<% end %> | ||
|
||
<% define_content :subject do %> | ||
<%= t :subject, "Quiz Regrade Finished: %{quiz}, %{context}", :quiz => asset.quiz.title, :context => asset.quiz.context.name %> | ||
<% end %> | ||
|
||
<%= t :body, "A regrade has finsihed for the quiz %{quiz}", :quiz => asset.quiz %> | ||
|
||
<%= t :link_message, "You can view the quiz here:" %> | ||
<%= content :link %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% define_content :link do %> | ||
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.quiz.context) %>/<%= polymorphic_path([asset.quiz.context,asset.quiz]) %> | ||
<% end %> | ||
|
||
<p> | ||
<% define_content :subject do %> | ||
<%= t :subject, "Quiz Regrade Finished: %{quiz}, %{context}", :quiz => asset.quiz.title, :context => asset.quiz.context.name %> | ||
<% end %> | ||
</p> | ||
|
||
<p><%= t :body, "A regrade has finsihed for the quiz %{quiz}", :quiz => asset.quiz %></p> | ||
|
||
<p> | ||
<%= t :link_message, "You can view the quiz here:" %> | ||
<a href="<%= content :link %>"><%= t :link_message, "You can view the quiz here:" %></a> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<% define_content :link do %> | ||
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.quiz.context) %>/<%= polymorphic_path([asset.quiz.context,asset.quiz]) %> | ||
<% end %> | ||
|
||
<p><%= t :body, "Quiz Regrade Finished: %{title}", :title => asset.quiz.title %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= t :body_sms, "Quiz Regrade Finished for %{title} in %{context}.", :title => asset.quiz.title, :context => asset.quiz.context %> | ||
|
||
<%= t :more_info, "More info at %{url}", :url => HostUrl.context_host(asset.quiz.context) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<% define_content :link do %> | ||
<%= HostUrl.protocol %>://<%= polymorphic_path([asset.quiz.context,asset.quiz]) %> | ||
<% end %> | ||
|
||
<% define_content :subject do %> | ||
<%= t :subject, "Quiz Regraded: %{quiz}, %{context}", :quiz => asset.quiz.title, :context => asset.quiz.context.name %> | ||
<% end %> | ||
|
||
<%= t :body, "A regrade has finished for your quiz %{title}.", :title => asset.quiz.title, :wrapper => "<b><a href=\"#{content :link}\">\\1</a></b>" %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<% define_content :link do %> | ||
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.quiz.context) %>/<%= polymorphic_path([asset.quiz.context,asset.quiz]) %> | ||
<% end %> | ||
<%= t :body, "Canvas Alert - Quiz Regraded : %{quiz}", :quiz => asset.quiz.title %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class QuizQuestionRegrade < ActiveRecord::Base | ||
attr_accessible :quiz_question_id, :quiz_regrade_id, :regrade_option | ||
belongs_to :quiz_question | ||
belongs_to :quiz_regrade | ||
|
||
validates_presence_of :quiz_question_id | ||
validates_presence_of :quiz_regrade_id | ||
|
||
delegate :question_data, to: :quiz_question | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class QuizRegrade < ActiveRecord::Base | ||
attr_accessible :user_id, :quiz_id, :quiz_version | ||
belongs_to :quiz | ||
belongs_to :user | ||
has_many :quiz_regrade_runs | ||
has_many :quiz_question_regrades | ||
|
||
validates_presence_of :quiz_version | ||
validates_presence_of :quiz_id | ||
validates_presence_of :user_id | ||
|
||
delegate :teachers, to: :quiz | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class QuizRegradeRun < ActiveRecord::Base | ||
belongs_to :quiz_regrade | ||
attr_accessible :quiz_regrade_id, :started_at, :finished_at | ||
validates_presence_of :quiz_regrade_id | ||
|
||
def self.perform(regrade) | ||
run = create!(quiz_regrade_id: regrade.id, started_at: Time.now) | ||
yield | ||
run.finished_at = Time.now | ||
run.save! | ||
end | ||
|
||
has_a_broadcast_policy | ||
set_broadcast_policy do |policy| | ||
policy.dispatch :quiz_regrade_finished | ||
policy.to { teachers } | ||
policy.whenever do |run| | ||
old,new = run.changes['finished_at'] | ||
!!(new && old.nil?) | ||
end | ||
end | ||
|
||
delegate :teachers, :quiz, to: :quiz_regrade | ||
end |
Oops, something went wrong.