CSC/ECE 517 Fall 2015/oss E1550 KMM: Difference between revisions
mNo edit summary |
No edit summary |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
=== E1550: Refactoring response.rb and response_helper.rb === | |||
= response.rb = | |||
== response.rb == | |||
response.rb is the class that manages the response to all rubrics in Expertiza. if someone fills out a review form, the instance of the review form is a Response. If someone gives feedback (a “rejoinder”) to an author, that is a Response too. Or if someone evaluates a teammate contribution, fills out a survey, or takes a quiz, they are creating a Response. | response.rb is the class that manages the response to all rubrics in Expertiza. if someone fills out a review form, the instance of the review form is a Response. If someone gives feedback (a “rejoinder”) to an author, that is a Response too. Or if someone evaluates a teammate contribution, fills out a survey, or takes a quiz, they are creating a Response. | ||
== Rubric type checking via message to ResponseMap == | Note: Method display_as_html writes the HTML for displaying a rubric. This would ordinarily be view code, but it is used by so many different views that it is done here. Questions are written out in the order of their sequence number (anyone who creates a rubric can specify sequence numbers for questions). After all questions are displayed, there is a blank for an additional comment. | ||
== Ensure score calculations utilize the weight of questions == | |||
== Relocate/Refactor code for sending emails to app/mailers == | ==== Rubric type checking via message to ResponseMap ==== | ||
== Remove comments in lines 25-27 == | |||
= response_helper.rb = | |||
[[File:response1.JPG |frame|center|Auto selected Reviewing]] | |||
[[File:response2.JPG |frame|center|Auto selected Reviewing]] | |||
[[File:response3.JPG |frame|center|Auto selected Reviewing]] | |||
[[File:response4.JPG |frame|center|Auto selected Reviewing]] | |||
[[File:response5.png |frame|center|Auto selected Reviewing]] | |||
[[File:response6.png |frame|center|Auto selected Reviewing]] | |||
==== Ensure score calculations utilize the weight of questions ==== | |||
When the get_maximum_score() function is called it takes care of the weight of the question. It multiplies the weight to the score and adds it to the final score. | |||
<pre> | |||
def get_maximum_score() | |||
# only count the scorable questions, only when the answer is not nil (we accept nil as answer for scorable questions, and they will not be counted towards the total score) | |||
total_weight = 0 | |||
scores.each do |s| | |||
question = Question.find(s.question_id) | |||
if !s.answer.nil? && question.is_a?(ScoredQuestion) | |||
total_weight+=question.weight | |||
end | |||
end | |||
if scores.empty? | |||
questionnaire = questionnaire_by_answer(nil) | |||
else | |||
questionnaire = questionnaire_by_answer(scores.first) | |||
end | |||
total_weight*questionnaire.max_question_score | |||
end | |||
</pre> | |||
==== Relocate/Refactor code for sending emails to app/mailers ==== | |||
All the email code has been shifted to the mailers | |||
==== Remove comments in lines 25-27 ==== | |||
Comments have been removed. | |||
[[File:Comments.JPG |frame|center|Auto selected Reviewing]] | |||
== response_helper.rb == | |||
response_helper.rb contains helper methods that display the questionnaires and rearrange questions so that the most frequently answered questions are at the bottom while the less frequently answered questions are at the top. | response_helper.rb contains helper methods that display the questionnaires and rearrange questions so that the most frequently answered questions are at the bottom while the less frequently answered questions are at the top. | ||
== Refactor construct_table method == | ==== Refactor construct_table method ==== | ||
Method is no longer being used in Expertiza and has been removed. | Method is no longer being used in Expertiza and has been removed. | ||
== Refactor rearrange_questions method == | ==== Refactor rearrange_questions method ==== | ||
Method is no longer being used in Expertiza and has been removed. | Method is no longer being used in Expertiza and has been removed. | ||
[[File:response_helper.png |frame|center|Auto selected Reviewing]] |
Latest revision as of 23:49, 6 November 2015
E1550: Refactoring response.rb and response_helper.rb
response.rb
response.rb is the class that manages the response to all rubrics in Expertiza. if someone fills out a review form, the instance of the review form is a Response. If someone gives feedback (a “rejoinder”) to an author, that is a Response too. Or if someone evaluates a teammate contribution, fills out a survey, or takes a quiz, they are creating a Response.
Note: Method display_as_html writes the HTML for displaying a rubric. This would ordinarily be view code, but it is used by so many different views that it is done here. Questions are written out in the order of their sequence number (anyone who creates a rubric can specify sequence numbers for questions). After all questions are displayed, there is a blank for an additional comment.
Rubric type checking via message to ResponseMap
Ensure score calculations utilize the weight of questions
When the get_maximum_score() function is called it takes care of the weight of the question. It multiplies the weight to the score and adds it to the final score.
def get_maximum_score() # only count the scorable questions, only when the answer is not nil (we accept nil as answer for scorable questions, and they will not be counted towards the total score) total_weight = 0 scores.each do |s| question = Question.find(s.question_id) if !s.answer.nil? && question.is_a?(ScoredQuestion) total_weight+=question.weight end end if scores.empty? questionnaire = questionnaire_by_answer(nil) else questionnaire = questionnaire_by_answer(scores.first) end total_weight*questionnaire.max_question_score end
Relocate/Refactor code for sending emails to app/mailers
All the email code has been shifted to the mailers
Remove comments in lines 25-27
Comments have been removed.
response_helper.rb
response_helper.rb contains helper methods that display the questionnaires and rearrange questions so that the most frequently answered questions are at the bottom while the less frequently answered questions are at the top.
Refactor construct_table method
Method is no longer being used in Expertiza and has been removed.
Refactor rearrange_questions method
Method is no longer being used in Expertiza and has been removed.