<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gmkhande</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gmkhande"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Gmkhande"/>
	<updated>2026-05-16T23:30:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103224</id>
		<title>CSC/ECE 517 Fall 2016/E1640. Refactor response.rb and response helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103224"/>
		<updated>2016-10-28T22:49:59Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: /* Code Modifications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction to Expertiza'''==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web application developed using [http://rubyonrails.org/ Ruby on Rails] for online assignment assessment. It is an open source project and its code base is maintained in the [http://github.com/ Git repository]. Expertiza authorizes the instructor to create new assignments as well as modify the existing ones. Students can team up with other students in Expertiza to work on various projects and assignments. Students can also review other students' work, thus enabling peer learning. After a particular response is recorded, the rubric gets displayed in graphical form under Your Scores tab. The submitted work can be seen in Your Work tab and the feedback given can be seen in Others' Work. The teammates for a particular project can be seen in Your team tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
===Response Model===&lt;br /&gt;
&lt;br /&gt;
Response.rb is a class that manages the response to all rubrics in Expertiza. The review form, quiz attempt, teammate review, review for others' work, filling a survey are all treated as responses. Method display_as_html handles the front-end for displaying a rubric.&lt;br /&gt;
&lt;br /&gt;
===Helper module===&lt;br /&gt;
&lt;br /&gt;
Response_helper.rb&lt;br /&gt;
&lt;br /&gt;
It contains two kinds of methods:&lt;br /&gt;
&lt;br /&gt;
1) Methods related to the display of questionnaires.  &lt;br /&gt;
&lt;br /&gt;
2) Methods to open a rubric on selecting a particular section name.&lt;br /&gt;
&lt;br /&gt;
This contains a method that rearranges the questions based on the frequency of answers to the questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Requirements'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb:'''&lt;br /&gt;
&lt;br /&gt;
1) The class contains code that checks the rubric type (ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap).  These classes are sub-classes of ResponseMap.  Rather than checking the map type, the code should send a message to the ResponseMap, and the code for specific types of ResponseMaps should be implemented in the subclasses of ResponseMap.&lt;br /&gt;
&lt;br /&gt;
2) Code for calculating scores seems to be incorrect, as it should multiply per-question scores by the weight for each question.  It seems to ignore weighting.&lt;br /&gt;
&lt;br /&gt;
3) Most of the code for sending e-mails should be moved to app/mailers.&lt;br /&gt;
&lt;br /&gt;
4) Remove the comment in lines 25–27 about TeamResponseMap; it is no longer relevant to the current version.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
1)The rearrange_questions method was written before we added sequence numbers to questions.  At the very least, it needs to be modified so that questions above the threshold are kept in sequence.  Ideally, it would be extended to allow the person who creates the rubric to specify whether each question could be moved or not, and then rearrange only the questions that are allowed to be moved, and add a column of check boxes to the Rubrics tab for assignment creation, saying whether questions on a particular rubric can be rearranged or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Issues addressed'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The functionality for email notification was initially cluttered in a single class Response. In the current version, this functionality is been divided into sub-classes depending on the response type. This has facilitated improved modularity and segregation of functionality into different classes.&lt;br /&gt;
&lt;br /&gt;
2) In the current version of the code, the total score is calculated by considering the weights for each question.&lt;br /&gt;
&lt;br /&gt;
3) The code for email notification is in the mailer module in the current version and the syn_message function is used for sending synchronous email messages after a response is entered.&lt;br /&gt;
&lt;br /&gt;
4) The irrelevant lines from TeamResponseMap are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The response_helper.rb is removed in the current version since it is dead code and not referenced anywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Code Modifications'''==&lt;br /&gt;
&lt;br /&gt;
The email notification functionality was initially in Response.rb and was shifted to the sub-classes as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Before Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model: Response.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email()&lt;br /&gt;
if response_map.type == &amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
  AssignmentTeam.find(response_map.reviewee_id).users.each do |user|&lt;br /&gt;
    defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                               SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                             else&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             end&lt;br /&gt;
    defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
    defn[:to] = User.find(user.id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver_now&lt;br /&gt;
  end&lt;br /&gt;
if response_map.type == &amp;quot;MetareviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
  reviewee_user = Participant.find(response_map.reviewee_id)&lt;br /&gt;
  signup_topic_id = SignedUpTeam.topic_id(assignment.id, response_map.contributor.teams_users.first.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
  defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
  defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;FeedbackResponseMap&amp;quot; # This is authors' feedback from UI&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
  # reviewee is a response, reviewer is a participant&lt;br /&gt;
  # we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
  response_id_for_original_feedback = response_map.reviewed_object_id&lt;br /&gt;
  response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
  response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
  original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
&lt;br /&gt;
  participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                             assignment.name&lt;br /&gt;
                           else&lt;br /&gt;
                             SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                           end&lt;br /&gt;
&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
  participant = AssignmentParticipant.find(response_map.reviewee_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;After Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model changed: Response.rb, ReviewResponseMap.rb, MetareviewResponseMap.rb, FeedbackResponseMap.rb, TeammateReviewResponseMap.rb&lt;br /&gt;
&amp;lt;br&amp;gt; Function added: email&lt;br /&gt;
&amp;lt;br&amp;gt; In ReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
    AssignmentTeam.find(reviewee_id).users.each do |user|&lt;br /&gt;
      defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                                 SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                               else&lt;br /&gt;
                                 assignment.name&lt;br /&gt;
                               end&lt;br /&gt;
      defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
      defn[:to] = User.find(user.id).email&lt;br /&gt;
      Mailer.sync_message(defn).deliver_now&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In MetareviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,participant,assignment)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
    reviewee_user = Participant.find(reviewee_id)&lt;br /&gt;
    signup_topic_id = SignedUpTeam.topic_id(assignment.id, contributor.teams_users.first.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
    defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
    defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In FeedbackResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
# reviewee is a response, reviewer is a participant&lt;br /&gt;
# we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
    response_id_for_original_feedback = reviewed_object_id&lt;br /&gt;
    response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
    response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
    original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
    participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             else&lt;br /&gt;
                               SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                             end&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In TeammateReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
    participant = AssignmentParticipant.find(reviewee_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
New refactoring has been tested and verified using existing Rspec tests. Manual testing has been done for the functionalities which does not have any existing Rspec tests.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on Github]&lt;br /&gt;
#[http://expertiza.ncsu.edu Current Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project Wiki Documentation]&lt;br /&gt;
#[http://guides.rubyonrails.org Ruby on Rails Guides]&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103223</id>
		<title>CSC/ECE 517 Fall 2016/E1640. Refactor response.rb and response helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103223"/>
		<updated>2016-10-28T22:49:15Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: /* Code Modifications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction to Expertiza'''==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web application developed using [http://rubyonrails.org/ Ruby on Rails] for online assignment assessment. It is an open source project and its code base is maintained in the [http://github.com/ Git repository]. Expertiza authorizes the instructor to create new assignments as well as modify the existing ones. Students can team up with other students in Expertiza to work on various projects and assignments. Students can also review other students' work, thus enabling peer learning. After a particular response is recorded, the rubric gets displayed in graphical form under Your Scores tab. The submitted work can be seen in Your Work tab and the feedback given can be seen in Others' Work. The teammates for a particular project can be seen in Your team tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
===Response Model===&lt;br /&gt;
&lt;br /&gt;
Response.rb is a class that manages the response to all rubrics in Expertiza. The review form, quiz attempt, teammate review, review for others' work, filling a survey are all treated as responses. Method display_as_html handles the front-end for displaying a rubric.&lt;br /&gt;
&lt;br /&gt;
===Helper module===&lt;br /&gt;
&lt;br /&gt;
Response_helper.rb&lt;br /&gt;
&lt;br /&gt;
It contains two kinds of methods:&lt;br /&gt;
&lt;br /&gt;
1) Methods related to the display of questionnaires.  &lt;br /&gt;
&lt;br /&gt;
2) Methods to open a rubric on selecting a particular section name.&lt;br /&gt;
&lt;br /&gt;
This contains a method that rearranges the questions based on the frequency of answers to the questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Requirements'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb:'''&lt;br /&gt;
&lt;br /&gt;
1) The class contains code that checks the rubric type (ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap).  These classes are sub-classes of ResponseMap.  Rather than checking the map type, the code should send a message to the ResponseMap, and the code for specific types of ResponseMaps should be implemented in the subclasses of ResponseMap.&lt;br /&gt;
&lt;br /&gt;
2) Code for calculating scores seems to be incorrect, as it should multiply per-question scores by the weight for each question.  It seems to ignore weighting.&lt;br /&gt;
&lt;br /&gt;
3) Most of the code for sending e-mails should be moved to app/mailers.&lt;br /&gt;
&lt;br /&gt;
4) Remove the comment in lines 25–27 about TeamResponseMap; it is no longer relevant to the current version.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
1)The rearrange_questions method was written before we added sequence numbers to questions.  At the very least, it needs to be modified so that questions above the threshold are kept in sequence.  Ideally, it would be extended to allow the person who creates the rubric to specify whether each question could be moved or not, and then rearrange only the questions that are allowed to be moved, and add a column of check boxes to the Rubrics tab for assignment creation, saying whether questions on a particular rubric can be rearranged or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Issues addressed'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The functionality for email notification was initially cluttered in a single class Response. In the current version, this functionality is been divided into sub-classes depending on the response type. This has facilitated improved modularity and segregation of functionality into different classes.&lt;br /&gt;
&lt;br /&gt;
2) In the current version of the code, the total score is calculated by considering the weights for each question.&lt;br /&gt;
&lt;br /&gt;
3) The code for email notification is in the mailer module in the current version and the syn_message function is used for sending synchronous email messages after a response is entered.&lt;br /&gt;
&lt;br /&gt;
4) The irrelevant lines from TeamResponseMap are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The response_helper.rb is removed in the current version since it is dead code and not referenced anywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Code Modifications'''==&lt;br /&gt;
&lt;br /&gt;
The email notification functionality was initially in Response.rb and was shifted to the sub-classes as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Before Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model: Response.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email()&lt;br /&gt;
if response_map.type == &amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
  AssignmentTeam.find(response_map.reviewee_id).users.each do |user|&lt;br /&gt;
    defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                               SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                             else&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             end&lt;br /&gt;
    defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
    defn[:to] = User.find(user.id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver_now&lt;br /&gt;
  end&lt;br /&gt;
if response_map.type == &amp;quot;MetareviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
  reviewee_user = Participant.find(response_map.reviewee_id)&lt;br /&gt;
  signup_topic_id = SignedUpTeam.topic_id(assignment.id, response_map.contributor.teams_users.first.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
  defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
  defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;FeedbackResponseMap&amp;quot; # This is authors' feedback from UI&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
  # reviewee is a response, reviewer is a participant&lt;br /&gt;
  # we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
  response_id_for_original_feedback = response_map.reviewed_object_id&lt;br /&gt;
  response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
  response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
  original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
&lt;br /&gt;
  participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                             assignment.name&lt;br /&gt;
                           else&lt;br /&gt;
                             SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                           end&lt;br /&gt;
&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
  participant = AssignmentParticipant.find(response_map.reviewee_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;After Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model changed: Response.rb, ReviewResponseMap.rb, MetareviewResponseMap.rb, FeedbackResponseMap.rb, TeammateReviewResponseMap.rb&lt;br /&gt;
&amp;lt;br&amp;gt; Function added: email&lt;br /&gt;
&amp;lt;br&amp;gt; In ReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
    AssignmentTeam.find(reviewee_id).users.each do |user|&lt;br /&gt;
      defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                                 SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                               else&lt;br /&gt;
                                 assignment.name&lt;br /&gt;
                               end&lt;br /&gt;
      defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
      defn[:to] = User.find(user.id).email&lt;br /&gt;
      Mailer.sync_message(defn).deliver_now&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In MetareviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,participant,assignment)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
    reviewee_user = Participant.find(reviewee_id)&lt;br /&gt;
    signup_topic_id = SignedUpTeam.topic_id(assignment.id, contributor.teams_users.first.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
    defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
    defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In FeedbackResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
# reviewee is a response, reviewer is a participant&lt;br /&gt;
# we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
    response_id_for_original_feedback = reviewed_object_id&lt;br /&gt;
    response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
    response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
    original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
    participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             else&lt;br /&gt;
                               SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                             end&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In TeammateReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
    participant = AssignmentParticipant.find(reviewee_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
New refactoring has been tested and verified using existing Rspec tests. Manual testing has been done for the functionalities which does not have any existing Rspec tests.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on Github]&lt;br /&gt;
#[http://expertiza.ncsu.edu Current Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project Wiki Documentation]&lt;br /&gt;
#[http://guides.rubyonrails.org Ruby on Rails Guides]&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103221</id>
		<title>CSC/ECE 517 Fall 2016/E1640. Refactor response.rb and response helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103221"/>
		<updated>2016-10-28T22:47:35Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction to Expertiza'''==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web application developed using [http://rubyonrails.org/ Ruby on Rails] for online assignment assessment. It is an open source project and its code base is maintained in the [http://github.com/ Git repository]. Expertiza authorizes the instructor to create new assignments as well as modify the existing ones. Students can team up with other students in Expertiza to work on various projects and assignments. Students can also review other students' work, thus enabling peer learning. After a particular response is recorded, the rubric gets displayed in graphical form under Your Scores tab. The submitted work can be seen in Your Work tab and the feedback given can be seen in Others' Work. The teammates for a particular project can be seen in Your team tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
===Response Model===&lt;br /&gt;
&lt;br /&gt;
Response.rb is a class that manages the response to all rubrics in Expertiza. The review form, quiz attempt, teammate review, review for others' work, filling a survey are all treated as responses. Method display_as_html handles the front-end for displaying a rubric.&lt;br /&gt;
&lt;br /&gt;
===Helper module===&lt;br /&gt;
&lt;br /&gt;
Response_helper.rb&lt;br /&gt;
&lt;br /&gt;
It contains two kinds of methods:&lt;br /&gt;
&lt;br /&gt;
1) Methods related to the display of questionnaires.  &lt;br /&gt;
&lt;br /&gt;
2) Methods to open a rubric on selecting a particular section name.&lt;br /&gt;
&lt;br /&gt;
This contains a method that rearranges the questions based on the frequency of answers to the questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Requirements'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb:'''&lt;br /&gt;
&lt;br /&gt;
1) The class contains code that checks the rubric type (ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap).  These classes are sub-classes of ResponseMap.  Rather than checking the map type, the code should send a message to the ResponseMap, and the code for specific types of ResponseMaps should be implemented in the subclasses of ResponseMap.&lt;br /&gt;
&lt;br /&gt;
2) Code for calculating scores seems to be incorrect, as it should multiply per-question scores by the weight for each question.  It seems to ignore weighting.&lt;br /&gt;
&lt;br /&gt;
3) Most of the code for sending e-mails should be moved to app/mailers.&lt;br /&gt;
&lt;br /&gt;
4) Remove the comment in lines 25–27 about TeamResponseMap; it is no longer relevant to the current version.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
1)The rearrange_questions method was written before we added sequence numbers to questions.  At the very least, it needs to be modified so that questions above the threshold are kept in sequence.  Ideally, it would be extended to allow the person who creates the rubric to specify whether each question could be moved or not, and then rearrange only the questions that are allowed to be moved, and add a column of check boxes to the Rubrics tab for assignment creation, saying whether questions on a particular rubric can be rearranged or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Issues addressed'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The functionality for email notification was initially cluttered in a single class Response. In the current version, this functionality is been divided into sub-classes depending on the response type. This has facilitated improved modularity and segregation of functionality into different classes.&lt;br /&gt;
&lt;br /&gt;
2) In the current version of the code, the total score is calculated by considering the weights for each question.&lt;br /&gt;
&lt;br /&gt;
3) The code for email notification is in the mailer module in the current version and the syn_message function is used for sending synchronous email messages after a response is entered.&lt;br /&gt;
&lt;br /&gt;
4) The irrelevant lines from TeamResponseMap are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The response_helper.rb is removed in the current version since it is dead code and not referenced anywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Code Modifications'''==&lt;br /&gt;
&lt;br /&gt;
The email notification functionality was initially in Response.rb and was shifted to the sub-classes as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Before Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model: Response.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if response_map.type == &amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
  AssignmentTeam.find(response_map.reviewee_id).users.each do |user|&lt;br /&gt;
    defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                               SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                             else&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             end&lt;br /&gt;
    defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
    defn[:to] = User.find(user.id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver_now&lt;br /&gt;
  end&lt;br /&gt;
if response_map.type == &amp;quot;MetareviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
  reviewee_user = Participant.find(response_map.reviewee_id)&lt;br /&gt;
  signup_topic_id = SignedUpTeam.topic_id(assignment.id, response_map.contributor.teams_users.first.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
  defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
  defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;FeedbackResponseMap&amp;quot; # This is authors' feedback from UI&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
  # reviewee is a response, reviewer is a participant&lt;br /&gt;
  # we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
  response_id_for_original_feedback = response_map.reviewed_object_id&lt;br /&gt;
  response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
  response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
  original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
&lt;br /&gt;
  participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                             assignment.name&lt;br /&gt;
                           else&lt;br /&gt;
                             SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                           end&lt;br /&gt;
&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
  participant = AssignmentParticipant.find(response_map.reviewee_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;After Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model changed: Response.rb, ReviewResponseMap.rb, MetareviewResponseMap.rb, FeedbackResponseMap.rb, TeammateReviewResponseMap.rb&lt;br /&gt;
&amp;lt;br&amp;gt; Function added: email&lt;br /&gt;
&amp;lt;br&amp;gt; In ReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
    AssignmentTeam.find(reviewee_id).users.each do |user|&lt;br /&gt;
      defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                                 SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                               else&lt;br /&gt;
                                 assignment.name&lt;br /&gt;
                               end&lt;br /&gt;
      defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
      defn[:to] = User.find(user.id).email&lt;br /&gt;
      Mailer.sync_message(defn).deliver_now&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In MetareviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,participant,assignment)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
    reviewee_user = Participant.find(reviewee_id)&lt;br /&gt;
    signup_topic_id = SignedUpTeam.topic_id(assignment.id, contributor.teams_users.first.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
    defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
    defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In FeedbackResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
# reviewee is a response, reviewer is a participant&lt;br /&gt;
# we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
    response_id_for_original_feedback = reviewed_object_id&lt;br /&gt;
    response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
    response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
    original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
    participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             else&lt;br /&gt;
                               SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                             end&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In TeammateReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
    participant = AssignmentParticipant.find(reviewee_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
New refactoring has been tested and verified using existing Rspec tests. Manual testing has been done for the functionalities which does not have any existing Rspec tests.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on Github]&lt;br /&gt;
#[http://expertiza.ncsu.edu Current Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project Wiki Documentation]&lt;br /&gt;
#[http://guides.rubyonrails.org Ruby on Rails Guides]&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103213</id>
		<title>CSC/ECE 517 Fall 2016/E1640. Refactor response.rb and response helper.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640._Refactor_response.rb_and_response_helper.rb&amp;diff=103213"/>
		<updated>2016-10-28T22:41:36Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: Created page with &amp;quot;=='''Introduction to Expertiza'''==  [http://expertiza.ncsu.edu/ Expertiza] is a web application developed using [http://rubyonrails.org/ Ruby on Rails] for online assignment ass...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction to Expertiza'''==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web application developed using [http://rubyonrails.org/ Ruby on Rails] for online assignment assessment. It is an open source project and its code base is maintained in the [http://github.com/ Git repository]. Expertiza authorizes the instructor to create new assignments as well as modify the existing ones. Students can team up with other students in Expertiza to work on various projects and assignments. Students can also review other students' work, thus enabling peer learning. After a particular response is recorded, the rubric gets displayed in graphical form under Your Scores tab. The submitted work can be seen in Your Work tab and the feedback given can be seen in Others' Work. The teammates for a particular project can be seen in Your team tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
===Response Model===&lt;br /&gt;
&lt;br /&gt;
Response.rb is a class that manages the response to all rubrics in Expertiza. The review form, quiz attempt, teammate review, review for others' work, filling a survey are all treated as responses. Method display_as_html handles the front-end for displaying a rubric.&lt;br /&gt;
&lt;br /&gt;
===Helper module===&lt;br /&gt;
&lt;br /&gt;
Response_helper.rb&lt;br /&gt;
&lt;br /&gt;
It contains two kinds of methods:&lt;br /&gt;
&lt;br /&gt;
1) Methods related to the display of questionnaires.  &lt;br /&gt;
&lt;br /&gt;
2) Methods to open a rubric on selecting a particular section name.&lt;br /&gt;
&lt;br /&gt;
This contains a method that rearranges the questions based on the frequency of answers to the questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Requirements'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb:'''&lt;br /&gt;
&lt;br /&gt;
1) The class contains code that checks the rubric type (ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap).  These classes are sub-classes of ResponseMap.  Rather than checking the map type, the code should send a message to the ResponseMap, and the code for specific types of ResponseMaps should be implemented in the subclasses of ResponseMap.&lt;br /&gt;
&lt;br /&gt;
2) Code for calculating scores seems to be incorrect, as it should multiply per-question scores by the weight for each question.  It seems to ignore weighting.&lt;br /&gt;
&lt;br /&gt;
3) Most of the code for sending e-mails should be moved to app/mailers.&lt;br /&gt;
&lt;br /&gt;
4) Remove the comment in lines 25–27 about TeamResponseMap; it is no longer relevant to the current version.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
1)The rearrange_questions method was written before we added sequence numbers to questions.  At the very least, it needs to be modified so that questions above the threshold are kept in sequence.  Ideally, it would be extended to allow the person who creates the rubric to specify whether each question could be moved or not, and then rearrange only the questions that are allowed to be moved, and add a column of check boxes to the Rubrics tab for assignment creation, saying whether questions on a particular rubric can be rearranged or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Issues addressed'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The functionality for email notification was initially cluttered in a single class Response. In the current version, this functionality is been divided into sub-classes depending on the response type. This has facilitated improved modularity and segregation of functionality into different classes.&lt;br /&gt;
&lt;br /&gt;
2) In the current version of the code, the total score is calculated by considering the weights for each question.&lt;br /&gt;
&lt;br /&gt;
3) The code for email notification is in the mailer module in the current version and the syn_message function is used for sending synchronous email messages after a response is entered.&lt;br /&gt;
&lt;br /&gt;
4) The irrelevant lines from TeamResponseMap are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The response_helper.rb is removed in the current version since it is dead code and not referenced anywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Code Modifications'''==&lt;br /&gt;
&lt;br /&gt;
The email notification functionality was initially in Response.rb and was shifted to the sub-classes as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Before Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model: Response.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if response_map.type == &amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
  AssignmentTeam.find(response_map.reviewee_id).users.each do |user|&lt;br /&gt;
    defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                               SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                             else&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             end&lt;br /&gt;
    defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
    defn[:to] = User.find(user.id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver_now&lt;br /&gt;
  end&lt;br /&gt;
if response_map.type == &amp;quot;MetareviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
  reviewee_user = Participant.find(response_map.reviewee_id)&lt;br /&gt;
  signup_topic_id = SignedUpTeam.topic_id(assignment.id, response_map.contributor.teams_users.first.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
  defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
  defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;FeedbackResponseMap&amp;quot; # This is authors' feedback from UI&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
  # reviewee is a response, reviewer is a participant&lt;br /&gt;
  # we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
  response_id_for_original_feedback = response_map.reviewed_object_id&lt;br /&gt;
  response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
  response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
  original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
&lt;br /&gt;
  participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                             assignment.name&lt;br /&gt;
                           else&lt;br /&gt;
                             SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                           end&lt;br /&gt;
&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
  participant = AssignmentParticipant.find(response_map.reviewee_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;After Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model changed: Response.rb, ReviewResponseMap.rb, MetareviewResponseMap.rb, FeedbackResponseMap.rb, TeammateReviewResponseMap.rb&lt;br /&gt;
&amp;lt;br&amp;gt; Function added: email&lt;br /&gt;
&amp;lt;br&amp;gt; In ReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
    AssignmentTeam.find(reviewee_id).users.each do |user|&lt;br /&gt;
      defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                                 SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                               else&lt;br /&gt;
                                 assignment.name&lt;br /&gt;
                               end&lt;br /&gt;
      defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
      defn[:to] = User.find(user.id).email&lt;br /&gt;
      Mailer.sync_message(defn).deliver_now&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In MetareviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,participant,assignment)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
    reviewee_user = Participant.find(reviewee_id)&lt;br /&gt;
    signup_topic_id = SignedUpTeam.topic_id(assignment.id, contributor.teams_users.first.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
    defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
    defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In FeedbackResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
# reviewee is a response, reviewer is a participant&lt;br /&gt;
# we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
    response_id_for_original_feedback = reviewed_object_id&lt;br /&gt;
    response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
    response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
    original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
    participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             else&lt;br /&gt;
                               SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                             end&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In TeammateReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
    participant = AssignmentParticipant.find(reviewee_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
New refactoring modification has been tested and verified using existing Rspec tests. Manual testing has been done for the functionalities which does not have any existing Rspec tests.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on Github]&lt;br /&gt;
#[http://expertiza.ncsu.edu Current Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project Wiki Documentation]&lt;br /&gt;
#[http://guides.rubyonrails.org Ruby on Rails Guides]&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016&amp;diff=103212</id>
		<title>CSC/ECE 517 Fall 2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016&amp;diff=103212"/>
		<updated>2016-10-28T22:40:52Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: /* Writing Assignments 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.example.com link title]==Calibration Assignment Submissions==&lt;br /&gt;
*[[Calibration Assignment Submission (Firebrick JS)]]&lt;br /&gt;
*[[Calibration Assignment Submission (Active Job)]]&lt;br /&gt;
==Writing Assignments 2==&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1666. Test team functionality]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1643. Refactor Suggestion controller]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1631. Refactoring Bidding Interface]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1674.Refactor leaderboard.rb and write unit tests]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1668.Test e-mailing functionality]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1658. Refractor lottery_controller.rb and write integration tests]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1660. Review requirements and thresholds]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1650. Sort instructor views alphabetically by default]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1644. Refactor and test Teams Controller]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1659. Refactor on_the_fly_calc.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1657. Introduce a Student View for instructors]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1653. Fix and improve rubric criteria]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1642. Refactor review_response_map.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1664:_Feature_Test_Assignment_Creation]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2016/E1666. Test team functionality]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1654. Improve_date-picker_and_deadlines]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1652 Fix teammate advertisements and requests to join a team ]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1662. UI issues/fixes]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1673. Refactor question_type.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1675. Timestamp for student file &amp;amp; hyperlink submissions]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2016/E1640. Refactor response.rb and response_helper.rb]]&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640&amp;diff=103201</id>
		<title>CSC/ECE 517 Fall 2016/E1640</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640&amp;diff=103201"/>
		<updated>2016-10-28T22:34:07Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=='''Introduction to Expertiza'''==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web application developed using [http://rubyonrails.org/ Ruby on Rails] for online assignment assessment. It is an open source project and its code base is maintained in the [http://github.com/ Git repository]. Expertiza authorizes the instructor to create new assignments as well as modify the existing ones. Students can team up with other students in Expertiza to work on various projects and assignments. Students can also review other students' work, thus enabling peer learning. After a particular response is recorded, the rubric gets displayed in graphical form under Your Scores tab. The submitted work can be seen in Your Work tab and the feedback given can be seen in Others' Work. The teammates for a particular project can be seen in Your team tab.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Overview'''==&lt;br /&gt;
===Response Model===&lt;br /&gt;
&lt;br /&gt;
Response.rb is a class that manages the response to all rubrics in Expertiza. The review form, quiz attempt, teammate review, review for others' work, filling a survey are all treated as responses. Method display_as_html handles the front-end for displaying a rubric.&lt;br /&gt;
&lt;br /&gt;
===Helper module===&lt;br /&gt;
&lt;br /&gt;
Response_helper.rb&lt;br /&gt;
&lt;br /&gt;
It contains two kinds of methods:&lt;br /&gt;
&lt;br /&gt;
1) Methods related to the display of questionnaires.  &lt;br /&gt;
&lt;br /&gt;
2) Methods to open a rubric on selecting a particular section name.&lt;br /&gt;
&lt;br /&gt;
This contains a method that rearranges the questions based on the frequency of answers to the questions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Project Requirements'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb:'''&lt;br /&gt;
&lt;br /&gt;
1) The class contains code that checks the rubric type (ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap, TeammateReviewResponseMap).  These classes are sub-classes of ResponseMap.  Rather than checking the map type, the code should send a message to the ResponseMap, and the code for specific types of ResponseMaps should be implemented in the subclasses of ResponseMap.&lt;br /&gt;
&lt;br /&gt;
2) Code for calculating scores seems to be incorrect, as it should multiply per-question scores by the weight for each question.  It seems to ignore weighting.&lt;br /&gt;
&lt;br /&gt;
3) Most of the code for sending e-mails should be moved to app/mailers.&lt;br /&gt;
&lt;br /&gt;
4) Remove the comment in lines 25–27 about TeamResponseMap; it is no longer relevant to the current version.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb:'''&lt;br /&gt;
&lt;br /&gt;
1)The rearrange_questions method was written before we added sequence numbers to questions.  At the very least, it needs to be modified so that questions above the threshold are kept in sequence.  Ideally, it would be extended to allow the person who creates the rubric to specify whether each question could be moved or not, and then rearrange only the questions that are allowed to be moved, and add a column of check boxes to the Rubrics tab for assignment creation, saying whether questions on a particular rubric can be rearranged or not.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Issues addressed'''==&lt;br /&gt;
&lt;br /&gt;
'''In response.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The functionality for email notification was initially cluttered in a single class Response. In the current version, this functionality is been divided into sub-classes depending on the response type. This has facilitated improved modularity and segregation of functionality into different classes.&lt;br /&gt;
&lt;br /&gt;
2) In the current version of the code, the total score is calculated by considering the weights for each question.&lt;br /&gt;
&lt;br /&gt;
3) The code for email notification is in the mailer module in the current version and the syn_message function is used for sending synchronous email messages after a response is entered.&lt;br /&gt;
&lt;br /&gt;
4) The irrelevant lines from TeamResponseMap are removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In response_helper.rb'''&lt;br /&gt;
&lt;br /&gt;
1) The response_helper.rb is removed in the current version since it is dead code and not referenced anywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=='''Code Modifications'''==&lt;br /&gt;
&lt;br /&gt;
The email notification functionality was initially in Response.rb and was shifted to the sub-classes as below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Before Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model: Response.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if response_map.type == &amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
  AssignmentTeam.find(response_map.reviewee_id).users.each do |user|&lt;br /&gt;
    defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                               SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                             else&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             end&lt;br /&gt;
    defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
    defn[:to] = User.find(user.id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver_now&lt;br /&gt;
  end&lt;br /&gt;
if response_map.type == &amp;quot;MetareviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
  reviewee_user = Participant.find(response_map.reviewee_id)&lt;br /&gt;
  signup_topic_id = SignedUpTeam.topic_id(assignment.id, response_map.contributor.teams_users.first.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
  defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
  defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;FeedbackResponseMap&amp;quot; # This is authors' feedback from UI&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
  # reviewee is a response, reviewer is a participant&lt;br /&gt;
  # we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
  response_id_for_original_feedback = response_map.reviewed_object_id&lt;br /&gt;
  response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
  response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
  original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
&lt;br /&gt;
  participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                             assignment.name&lt;br /&gt;
                           else&lt;br /&gt;
                             SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                           end&lt;br /&gt;
&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
if response_map.type == &amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
  defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
  participant = AssignmentParticipant.find(response_map.reviewee_id)&lt;br /&gt;
  topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
  defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
  user = User.find(participant.user_id)&lt;br /&gt;
  defn[:body][:first_name] = user.fullname&lt;br /&gt;
  defn[:to] = user.email&lt;br /&gt;
  Mailer.sync_message(defn).deliver&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;After Refactoring :&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; Model changed: Response.rb, ReviewResponseMap.rb, MetareviewResponseMap.rb, FeedbackResponseMap.rb, TeammateReviewResponseMap.rb&lt;br /&gt;
&amp;lt;br&amp;gt; Function added: email&lt;br /&gt;
&amp;lt;br&amp;gt; In ReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Author Feedback&amp;quot;&lt;br /&gt;
    AssignmentTeam.find(reviewee_id).users.each do |user|&lt;br /&gt;
      defn[:body][:obj_name] = if assignment.has_topics?&lt;br /&gt;
                                 SignUpTopic.find(SignedUpTeam.topic_id(assignment.id, user.id)).topic_name&lt;br /&gt;
                               else&lt;br /&gt;
                                 assignment.name&lt;br /&gt;
                               end&lt;br /&gt;
      defn[:body][:first_name] = User.find(user.id).fullname&lt;br /&gt;
      defn[:to] = User.find(user.id).email&lt;br /&gt;
      Mailer.sync_message(defn).deliver_now&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In MetareviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,participant,assignment)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Metareview&amp;quot;&lt;br /&gt;
    reviewee_user = Participant.find(reviewee_id)&lt;br /&gt;
    signup_topic_id = SignedUpTeam.topic_id(assignment.id, contributor.teams_users.first.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(signup_topic_id).topic_name&lt;br /&gt;
    defn[:body][:first_name] = User.find(reviewee_user.user_id).fullname&lt;br /&gt;
    defn[:to] = User.find(reviewee_user.user_id).email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In FeedbackResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Review Feedback&amp;quot;&lt;br /&gt;
# reviewee is a response, reviewer is a participant&lt;br /&gt;
# we need to track back to find the original reviewer on whose work the author comments&lt;br /&gt;
    response_id_for_original_feedback = reviewed_object_id&lt;br /&gt;
    response_for_original_feedback = Response.find response_id_for_original_feedback&lt;br /&gt;
    response_map_for_original_feedback = ResponseMap.find response_for_original_feedback.map_id&lt;br /&gt;
    original_reviewer_participant_id = response_map_for_original_feedback.reviewer_id&lt;br /&gt;
    participant = AssignmentParticipant.find(original_reviewer_participant_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = if topic_id.nil?&lt;br /&gt;
                               assignment.name&lt;br /&gt;
                             else&lt;br /&gt;
                               SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
                             end&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt; In TeammateReviewResponseMap&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def email(defn,assignment,participant)&lt;br /&gt;
    defn[:body][:type] = &amp;quot;Teammate Review&amp;quot;&lt;br /&gt;
    participant = AssignmentParticipant.find(reviewee_id)&lt;br /&gt;
    topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
    defn[:body][:obj_name] = SignUpTopic.find(topic_id).topic_name rescue nil&lt;br /&gt;
    user = User.find(participant.user_id)&lt;br /&gt;
    defn[:body][:first_name] = user.fullname&lt;br /&gt;
    defn[:to] = user.email&lt;br /&gt;
    Mailer.sync_message(defn).deliver&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
New refactoring modification has been tested and verified using existing Rspec tests. Manual testing has been done for the functionalities which does not have any existing Rspec tests.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
#[http://github.com/expertiza/expertiza Expertiza on Github]&lt;br /&gt;
#[http://expertiza.ncsu.edu Current Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project Wiki Documentation]&lt;br /&gt;
#[http://guides.rubyonrails.org Ruby on Rails Guides]&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640&amp;diff=102537</id>
		<title>CSC/ECE 517 Fall 2016/E1640</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1640&amp;diff=102537"/>
		<updated>2016-10-27T21:33:04Z</updated>

		<summary type="html">&lt;p&gt;Gmkhande: Created page with &amp;quot;Introduction to Expertiza Expertiza is a web application developed using Ruby on Rails for online assignment assessment. It is an open source project and its code base is maintai...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Introduction to Expertiza&lt;br /&gt;
Expertiza is a web application developed using Ruby on Rails for online assignment assessment. It is an open source project and its code base is maintained in the Git repository. Expertiza authorizes the instructor to create new assignments as well as modify the existing ones. Students can team up with other students in Expertiza to work on various projects and assignments. Students can also review other students' work, thus enabling peer learning. After a particular response is recorded, the rubric gets displayed in graphical form under Your Scores tab. The submitted work can be seen in Your Work tab and the feedback given can be seen in Others' Work. The teammates for a particular project can be seen in Your team tab.&lt;br /&gt;
&lt;br /&gt;
Response Model&lt;br /&gt;
Response.rb is a class that manages the response to all rubrics in Expertiza. The review form, quiz attempt, teammate review, review for others' work, filling a survey are all treated as responses. Method display_as_html handles the front-end for displaying a rubric.&lt;br /&gt;
&lt;br /&gt;
Response_helper.rb&lt;br /&gt;
It contains two kinds of methods:&lt;br /&gt;
1) Methods related to the display of questionnaires.  &lt;br /&gt;
2) Methods to open a rubric on selecting a particular section name.&lt;br /&gt;
This contains method that rearranges the questions based on frequency of answers to the questions.&lt;br /&gt;
&lt;br /&gt;
Project Requirements:&lt;br /&gt;
&lt;br /&gt;
In response.rb:&lt;br /&gt;
1) The class contains code that checks the rubric type (ReviewResponseMap, MetareviewResponseMap, FeedbackResponseMap).  These classes are subclasses of ResponseMap.  Rather than checking the map type, the code should send a message to the ResponseMap, and the code for specific types of ResponseMaps should be implemented in the subclasses of ResponseMap.&lt;br /&gt;
2) Code for calculating scores seems to be incorrect, as it should multiply per-question scores by the weight for each question.  It seems to ignore weighting.&lt;br /&gt;
3) Most of the code for sending e-mails should be moved to app/mailers.&lt;br /&gt;
4) Remove the comment in lines 25–27 about TeamResponseMaps; it is no longer relevant to the current version.&lt;br /&gt;
&lt;br /&gt;
In response_helper.rb:&lt;br /&gt;
1)The rearrange_questions method was written before we added sequence numbers to questions.  At the very least, it needs to be modified so that questions above the threshold are kept in sequence.  Ideally, it would be extended to allow the person who creates the rubric to specify whether each question could be moved or not, and then rearrange only the questions that are allowed to be moved, and add a column of check boxes to the Rubrics tab for assignment creation, saying whether questions on a particular rubric can be rearranged or not.&lt;/div&gt;</summary>
		<author><name>Gmkhande</name></author>
	</entry>
</feed>