<?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=Ppkhawas</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=Ppkhawas"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ppkhawas"/>
	<updated>2026-08-17T05:27:49Z</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_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147316</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147316"/>
		<updated>2022-12-13T07:00:49Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
#Get Participant instructor_participant with user_id = assignment.instructor_id&lt;br /&gt;
#Create duplicate new_instructor_participant from instructor_participant&lt;br /&gt;
#Set new_instructor_participant.parent_id = new_assignment_id&lt;br /&gt;
#Save new_instructor_participant&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set new_response_map.reviewer_id = new_instructor_participant.id&lt;br /&gt;
##Set new_response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
###Get all Answers with response_id = response.id&lt;br /&gt;
###For each answer&lt;br /&gt;
####Create duplicate new_answer from answer&lt;br /&gt;
####Set new_answer.response_id = new_response.id&lt;br /&gt;
####Save new_answer&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Our Work ==&lt;br /&gt;
=== Added Participant#copy_to_another_assignment(assignment) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment. This method will be used in multiple places ahead.&lt;br /&gt;
  def copy_to_another_assignment(assignment)&lt;br /&gt;
    new_participant = dup&lt;br /&gt;
    new_participant.parent_id = assignment.id&lt;br /&gt;
    new_participant.save&lt;br /&gt;
    new_participant&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Added Answer#copy_to_response(response) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another response. This method will be used while copying all answers for a response.&lt;br /&gt;
  def copy_to_response(response)&lt;br /&gt;
    new_answer = dup&lt;br /&gt;
    new_answer.response_id = response.id&lt;br /&gt;
    new_answer.save&lt;br /&gt;
    new_answer&lt;br /&gt;
  end&lt;br /&gt;
=== Added Response#copy_to_another_response_map(response_map) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another response map along with all the associated answers.&lt;br /&gt;
  def copy_to_another_response_map(response_map)&lt;br /&gt;
    new_response = dup&lt;br /&gt;
    new_response.map_id = response_map.id&lt;br /&gt;
    new_response.save&lt;br /&gt;
    answers = Answer.where(response_id: id)&lt;br /&gt;
    answers.each do |answer|&lt;br /&gt;
      new_answer = answer.copy_to_response(new_response)&lt;br /&gt;
    end&lt;br /&gt;
    new_response&lt;br /&gt;
  end&lt;br /&gt;
=== Added SubmissionRecord#copy_to_another_team(team) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another team.&lt;br /&gt;
  def copy_to_another_team(team)&lt;br /&gt;
    new_submission_record = dup&lt;br /&gt;
    new_submission_record.team_id = team.id&lt;br /&gt;
    new_submission_record.assignment_id = team.parent_id&lt;br /&gt;
    new_submission_record.save&lt;br /&gt;
    new_submission_record&lt;br /&gt;
  end&lt;br /&gt;
=== Added Team#copy_to_another_assignment(assignment) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment along with associated team users, team user nodes and creates participants for the team users if not created before. Team#copy_members is reused to comply with DRY principle.&lt;br /&gt;
  def copy_to_another_assignment(new_assignment)&lt;br /&gt;
    new_team = dup&lt;br /&gt;
    new_team.parent_id = new_assignment.id&lt;br /&gt;
    new_team.save&lt;br /&gt;
    copy_members(new_team)&lt;br /&gt;
    # Creates a new Participant for every User in the Team and associates the Participant to the new Assignment&lt;br /&gt;
    team_users = TeamsUser.where(team_id: new_team.id)&lt;br /&gt;
    team_users.each do |team_user|&lt;br /&gt;
      # Checks if Participant for the new Assignment is missing for the given User&lt;br /&gt;
      participant_missing = Participant.where(&lt;br /&gt;
        parent_id: new_assignment.id, user_id: team_user.user_id&lt;br /&gt;
      ).first.nil?&lt;br /&gt;
      if participant_missing&lt;br /&gt;
        participant = Participant.where(parent_id: parent_id, user_id: team_user.user_id).first&lt;br /&gt;
        participant.copy_to_another_assignment(new_assignment)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    new_team&lt;br /&gt;
  end&lt;br /&gt;
=== Added ResponseMap#copy_to_another_assignment(assignment) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment along with the reviewee team and its associated submission records, and the responses and its associated answers.&lt;br /&gt;
  def copy_to_another_assignment(assignment, team, instructor_participant)&lt;br /&gt;
    new_response_map = dup&lt;br /&gt;
    new_response_map.reviewed_object_id = assignment.id&lt;br /&gt;
    new_response_map.reviewer_id = instructor_participant.id&lt;br /&gt;
    new_response_map.reviewee_id = team.id&lt;br /&gt;
    new_response_map.save&lt;br /&gt;
    submission_records = SubmissionRecord.where(assignment_id: reviewed_object_id, team_id: reviewee_id)&lt;br /&gt;
    submission_records.each do |submission_record|&lt;br /&gt;
      submission_record.copy_to_another_team(team)&lt;br /&gt;
    end&lt;br /&gt;
    responses = Response.where(map_id: id)&lt;br /&gt;
    responses.each do |response|&lt;br /&gt;
      response.copy_to_another_response_map(new_response_map)&lt;br /&gt;
    end&lt;br /&gt;
    new_response_map&lt;br /&gt;
  end&lt;br /&gt;
=== Added Assignment#copy_calibrated_submissions(new_assignment) ===&lt;br /&gt;
This method is the key method in our solution to copying calibrated submissions for an assignment. The method creates a participant for the instructor to allow them to be reviewers and processes each calibration response map object.&lt;br /&gt;
  def copy_calibration_submissions(new_assignment)&lt;br /&gt;
    # Create Participant entry for instructors to allow them to become reviewers&lt;br /&gt;
    instructor_participant = Participant.where(parent_id: id, user_id: instructor_id).first&lt;br /&gt;
    new_instructor_participant = instructor_participant.copy_to_another_assignment(new_assignment)&lt;br /&gt;
    response_maps = ResponseMap.where(reviewed_object_id: id, calibrate_to: 1)&lt;br /&gt;
    response_maps.each do |response_map|&lt;br /&gt;
      # Create a duplicate Team object from the Team associated with the ResponseMap object to add teams who's&lt;br /&gt;
      # submissions were used for calibration in the previous Assignments&lt;br /&gt;
      team = Team.where(id: response_map.reviewee_id).first&lt;br /&gt;
      new_team = team.copy_to_another_assignment(new_assignment)&lt;br /&gt;
      response_map.copy_to_another_assignment(new_assignment, new_team, new_instructor_participant)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
Finally the call to Assignment#copy_calibrated_submissions was added in AssignmentForm::copy.&lt;br /&gt;
    # Copies all calibration submissions along with Participants, Teams, TeamUsers, SubmissionRecords and Responses&lt;br /&gt;
    # of the old assignment on to the new Assignment&lt;br /&gt;
    old_assign.copy_calibration_submissions(new_assign)&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147315</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147315"/>
		<updated>2022-12-13T06:57:52Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Our Work&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
#Get Participant instructor_participant with user_id = assignment.instructor_id&lt;br /&gt;
#Create duplicate new_instructor_participant from instructor_participant&lt;br /&gt;
#Set new_instructor_participant.parent_id = new_assignment_id&lt;br /&gt;
#Save new_instructor_participant&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set new_response_map.reviewer_id = new_instructor_participant.id&lt;br /&gt;
##Set new_response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
###Get all Answers with response_id = response.id&lt;br /&gt;
###For each answer&lt;br /&gt;
####Create duplicate new_answer from answer&lt;br /&gt;
####Set new_answer.response_id = new_response.id&lt;br /&gt;
####Save new_answer&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Our Work ==&lt;br /&gt;
=== Added Participant#copy_to_another_assignment(assignment) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment. This method will be used in multiple places ahead.&lt;br /&gt;
  def copy_to_another_assignment(assignment)&lt;br /&gt;
    new_participant = dup&lt;br /&gt;
    new_participant.parent_id = assignment.id&lt;br /&gt;
    new_participant.save&lt;br /&gt;
    new_participant&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
=== Added Answer#copy_to_response(response) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another response. This method will be used while copying all answers for a response.&lt;br /&gt;
  def copy_to_response(response)&lt;br /&gt;
    new_answer = dup&lt;br /&gt;
    new_answer.response_id = response.id&lt;br /&gt;
    new_answer.save&lt;br /&gt;
    new_answer&lt;br /&gt;
  end&lt;br /&gt;
=== Added Response#copy_to_another_response_map(response_map) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another response map along with all the associated answers.&lt;br /&gt;
  def copy_to_another_response_map(response_map)&lt;br /&gt;
    new_response = dup&lt;br /&gt;
    new_response.map_id = response_map.id&lt;br /&gt;
    new_response.save&lt;br /&gt;
    answers = Answer.where(response_id: id)&lt;br /&gt;
    answers.each do |answer|&lt;br /&gt;
      new_answer = answer.copy_to_response(new_response)&lt;br /&gt;
    end&lt;br /&gt;
    new_response&lt;br /&gt;
  end&lt;br /&gt;
=== Added SubmissionRecord#copy_to_another_team(team) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another team.&lt;br /&gt;
  def copy_to_another_team(team)&lt;br /&gt;
    new_submission_record = dup&lt;br /&gt;
    new_submission_record.team_id = team.id&lt;br /&gt;
    new_submission_record.assignment_id = team.parent_id&lt;br /&gt;
    new_submission_record.save&lt;br /&gt;
    new_submission_record&lt;br /&gt;
  end&lt;br /&gt;
=== Added Team#copy_to_another_assignment(assignment) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment along with associated team users, team user nodes and creates participants for the team users if not created before. Team#copy_members is reused to comply with DRY principle.&lt;br /&gt;
  def copy_to_another_assignment(new_assignment)&lt;br /&gt;
    new_team = dup&lt;br /&gt;
    new_team.parent_id = new_assignment.id&lt;br /&gt;
    new_team.save&lt;br /&gt;
    copy_members(new_team)&lt;br /&gt;
    # Creates a new Participant for every User in the Team and associates the Participant to the new Assignment&lt;br /&gt;
    team_users = TeamsUser.where(team_id: new_team.id)&lt;br /&gt;
    team_users.each do |team_user|&lt;br /&gt;
      # Checks if Participant for the new Assignment is missing for the given User&lt;br /&gt;
      participant_missing = Participant.where(&lt;br /&gt;
        parent_id: new_assignment.id, user_id: team_user.user_id&lt;br /&gt;
      ).first.nil?&lt;br /&gt;
      if participant_missing&lt;br /&gt;
        participant = Participant.where(parent_id: parent_id, user_id: team_user.user_id).first&lt;br /&gt;
        participant.copy_to_another_assignment(new_assignment)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    new_team&lt;br /&gt;
  end&lt;br /&gt;
=== Added ResponseMap#copy_to_another_assignment(assignment) ===&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment along with the reviewee team and its associated submission records, and the responses and its associated answers.&lt;br /&gt;
  def copy_to_another_assignment(assignment, team, instructor_participant)&lt;br /&gt;
    new_response_map = dup&lt;br /&gt;
    new_response_map.reviewed_object_id = assignment.id&lt;br /&gt;
    new_response_map.reviewer_id = instructor_participant.id&lt;br /&gt;
    new_response_map.reviewee_id = team.id&lt;br /&gt;
    new_response_map.save&lt;br /&gt;
    submission_records = SubmissionRecord.where(assignment_id: reviewed_object_id, team_id: reviewee_id)&lt;br /&gt;
    submission_records.each do |submission_record|&lt;br /&gt;
      submission_record.copy_to_another_team(team)&lt;br /&gt;
    end&lt;br /&gt;
    responses = Response.where(map_id: id)&lt;br /&gt;
    responses.each do |response|&lt;br /&gt;
      response.copy_to_another_response_map(new_response_map)&lt;br /&gt;
    end&lt;br /&gt;
    new_response_map&lt;br /&gt;
  end&lt;br /&gt;
=== Added Assignment#copy_calibrated_submissions(new_assignment) ===&lt;br /&gt;
This method is the key method in our solution to copying calibrated submissions for an assignment. The method creates a participant for the instructor to allow them to be reviewers and processes each calibration response map object.&lt;br /&gt;
  def copy_calibration_submissions(new_assignment)&lt;br /&gt;
    # Create Participant entry for instructors to allow them to become reviewers&lt;br /&gt;
    instructor_participant = Participant.where(parent_id: id, user_id: instructor_id).first&lt;br /&gt;
    new_instructor_participant = instructor_participant.copy_to_another_assignment(new_assignment)&lt;br /&gt;
    response_maps = ResponseMap.where(reviewed_object_id: id, calibrate_to: 1)&lt;br /&gt;
    response_maps.each do |response_map|&lt;br /&gt;
      # Create a duplicate Team object from the Team associated with the ResponseMap object to add teams who's&lt;br /&gt;
      # submissions were used for calibration in the previous Assignments&lt;br /&gt;
      team = Team.where(id: response_map.reviewee_id).first&lt;br /&gt;
      new_team = team.copy_to_another_assignment(new_assignment)&lt;br /&gt;
      response_map.copy_to_another_assignment(new_assignment, new_team, new_instructor_participant)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147314</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147314"/>
		<updated>2022-12-13T06:36:11Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Added Our Work Section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
#Get Participant instructor_participant with user_id = assignment.instructor_id&lt;br /&gt;
#Create duplicate new_instructor_participant from instructor_participant&lt;br /&gt;
#Set new_instructor_participant.parent_id = new_assignment_id&lt;br /&gt;
#Save new_instructor_participant&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set new_response_map.reviewer_id = new_instructor_participant.id&lt;br /&gt;
##Set new_response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
###Get all Answers with response_id = response.id&lt;br /&gt;
###For each answer&lt;br /&gt;
####Create duplicate new_answer from answer&lt;br /&gt;
####Set new_answer.response_id = new_response.id&lt;br /&gt;
####Save new_answer&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Our Work ==&lt;br /&gt;
=== Added Participant#copy_to_another_assignment(assignment)&lt;br /&gt;
This method copies a duplicate entry of itself to another assignment. This method will be used in multiple places ahead.&lt;br /&gt;
  def copy_to_another_assignment(assignment)&lt;br /&gt;
    new_participant = dup&lt;br /&gt;
    new_participant.parent_id = assignment.id&lt;br /&gt;
    new_participant.save&lt;br /&gt;
    new_participant&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147313</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147313"/>
		<updated>2022-12-13T06:23:30Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
#Get Participant instructor_participant with user_id = assignment.instructor_id&lt;br /&gt;
#Create duplicate new_instructor_participant from instructor_participant&lt;br /&gt;
#Set new_instructor_participant.parent_id = new_assignment_id&lt;br /&gt;
#Save new_instructor_participant&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set new_response_map.reviewer_id = new_instructor_participant.id&lt;br /&gt;
##Set new_response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
###Get all Answers with response_id = response.id&lt;br /&gt;
###For each answer&lt;br /&gt;
####Create duplicate new_answer from answer&lt;br /&gt;
####Set new_answer.response_id = new_response.id&lt;br /&gt;
####Save new_answer&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147312</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=147312"/>
		<updated>2022-12-13T06:22:56Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Updated Pseudocode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
#Get Participant instructor_participant with user_id = assignment.instructor_id&lt;br /&gt;
###Create duplicate new_instructor_participant from instructor_participant&lt;br /&gt;
###Set new_instructor_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_instructor_participant&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set new_response_map.reviewer_id = new_instructor_participant.id&lt;br /&gt;
##Set new_response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
###Get all Answers with response_id = response.id&lt;br /&gt;
###For each answer&lt;br /&gt;
####Create duplicate new_answer from answer&lt;br /&gt;
####Set new_answer.response_id = new_response.id&lt;br /&gt;
####Save new_answer&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146907</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146907"/>
		<updated>2022-11-23T00:09:24Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: /* Pseudocode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set new_response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146808</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146808"/>
		<updated>2022-11-21T00:30:54Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Updated Pseudocode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Principles we plan to use === &lt;br /&gt;
&lt;br /&gt;
#DRY: We intend to write code that is written only once and utilised wherever needed.&lt;br /&gt;
#Single Responsibility: Our modules, classes and functions would have one responsibility.&lt;br /&gt;
#Open-Closed: We would try to ensure that there is minimum necessity to modify our code and at the same time make sure that there is an opportunity for extension.&lt;br /&gt;
#Law of Demeter: Our classes would be written in such a way that they do not have knowledge of the internal working of other objects. They would not manipulate other objects. &lt;br /&gt;
#Maximize Cohesion and minimize coupling: Our modules would be written to have low dependency on other modules while depending highly on its member functions.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
&lt;br /&gt;
#Get all ResponseMaps with reviewed_object = assignment.id and calibrate_to = True&lt;br /&gt;
#For each response_map&lt;br /&gt;
##Create duplicate new_response_map from response_map&lt;br /&gt;
##Set new_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
##Find Team team where id = new_response_map.reviewee_id&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Set response_map.reviewee_id = new_team.id&lt;br /&gt;
##Save new_response_map&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get all TeamUsers where team_id = new_team.id&lt;br /&gt;
##For each team_user&lt;br /&gt;
###Get Participant participant where parent_id = assignment.id and user_id = team_user.user_id&lt;br /&gt;
###Create duplicate new_participant from participant&lt;br /&gt;
###Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
###Save new_participant&lt;br /&gt;
##Get all SubmissionRecords with assignment_id = old_assignment_id and team_id = team.id&lt;br /&gt;
##For each submission_record&lt;br /&gt;
###Create duplicate new_submission_record from submission_record&lt;br /&gt;
###Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
###Set new_submission_record.team_id = new_team.id&lt;br /&gt;
###Save new_submission_record&lt;br /&gt;
##Get all Responses with map_id = response_map.id&lt;br /&gt;
##For each response&lt;br /&gt;
###Create duplicate new_response from response&lt;br /&gt;
###Set new_response.map_id = new_response_map.id&lt;br /&gt;
###Save new_response&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146722</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146722"/>
		<updated>2022-11-16T06:04:39Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Added Planned Code Changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:networking.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Proposed Workflow ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowOSS2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode === &lt;br /&gt;
&lt;br /&gt;
#Get all SubmissionRecords with assignment_id = old_assignment_id&lt;br /&gt;
#For each submission_record&lt;br /&gt;
##Create duplicate new_submission_record from submission_record&lt;br /&gt;
##Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
##Save new_submission_record&lt;br /&gt;
#Get all teams with parent_id = old_assignment_id&lt;br /&gt;
#For each team&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get ReviewResponseMap with reviewee_id = team&lt;br /&gt;
##For each review_response_map&lt;br /&gt;
###Create duplicate new_review_response_map from review_response_map&lt;br /&gt;
###Set new_review_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
###Set new_review_response_map.reviewee_id = new_team.id&lt;br /&gt;
###Save the new_review_response_map&lt;br /&gt;
###Get all Responses with map_id = review_response_map.id&lt;br /&gt;
###For each response&lt;br /&gt;
####Create duplicate new_response from response&lt;br /&gt;
####Set new_response.map_id = new_review_response_map.id&lt;br /&gt;
####Save new_response&lt;br /&gt;
#Get all participants with parent_id = old_assignment_id&lt;br /&gt;
#For each participant&lt;br /&gt;
##Create duplicate new_participant&lt;br /&gt;
##Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
##Save new_participant&lt;br /&gt;
&lt;br /&gt;
=== Planned Code Changes ===&lt;br /&gt;
'''app/models/assignment.rb'''&lt;br /&gt;
#Add an instance method copy_calibrated_responses_from(old_assignment) that copies submissions, teams, participants, and responses from a calibrated assignment to the assignment instance.&lt;br /&gt;
#Add an instance method copy_submissions_from(old_assignment) that copies SubmissionRecords from the old_assignment to the assignment.&lt;br /&gt;
#Add an instance method copy_participants_from(old_assignment) that copies Participants from the old_assignment to the assignment.&lt;br /&gt;
'''app/models/team.rb'''&lt;br /&gt;
#Add a method get_review_response_mappings() that retrieves all ReviewResponseMappings associated to a team.&lt;br /&gt;
'''app/models/review_response_map.rb'''&lt;br /&gt;
#Add a method get_response() that retrieves the response for the review response mapping.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146707</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146707"/>
		<updated>2022-11-16T05:00:17Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Added Pseudocode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
# They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
# Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
# Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
# Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
## Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
##Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
###Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
# Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
*self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
*self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
*Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
*New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
* Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
* Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
* Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
* Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
* Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
* Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
* Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
* Added a method for copying extra participants, to not copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
As of now, when one clicks on the copy button next to the assignment and a copy is created, you can observe that the calibration tab of the copied assignment renders no results at all. &lt;br /&gt;
An empty table is shown &lt;br /&gt;
&lt;br /&gt;
[[File:networking.png]]&lt;br /&gt;
&lt;br /&gt;
=== Pseudocode ===&lt;br /&gt;
#Get all SubmissionRecords with assignment_id = old_assignment_id&lt;br /&gt;
#For each submission_record&lt;br /&gt;
##Create duplicate new_submission_record from submission_record&lt;br /&gt;
##Set new_submission_record.assignment_id = new_assignment_id&lt;br /&gt;
##Save new_submission_record&lt;br /&gt;
#Get all teams with parent_id = old_assignment_id&lt;br /&gt;
#For each team&lt;br /&gt;
##Create duplicate new_team from team&lt;br /&gt;
##Set new_team.parent_id = new_assignment_id&lt;br /&gt;
##Save new_team&lt;br /&gt;
##Copy members of team to new_team&lt;br /&gt;
##Get ReviewResponseMap with reviewee_id = team&lt;br /&gt;
##For each review_response_map&lt;br /&gt;
###Create duplicate new_review_response_map from review_response_map&lt;br /&gt;
###Set new_review_response_map.reviewed_object_id = new_assignment_id&lt;br /&gt;
###Set new_review_response_map.reviewee_id = new_team.id&lt;br /&gt;
###Save the new_review_response_map&lt;br /&gt;
###Get all Responses with map_id = review_response_map.id&lt;br /&gt;
###For each response&lt;br /&gt;
####Create duplicate new_response from response&lt;br /&gt;
####Set new_response.map_id = new_review_response_map.id&lt;br /&gt;
####Save new_response&lt;br /&gt;
#Get all participants with parent_id = old_assignment_id&lt;br /&gt;
#For each participant&lt;br /&gt;
##Create duplicate new_participant&lt;br /&gt;
##Set new_participant.parent_id = new_assignment_id&lt;br /&gt;
##Save new_participant&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing using Rspec===&lt;br /&gt;
&lt;br /&gt;
====Context====&lt;br /&gt;
When the original assignment to be copied is a calibrated assignment&lt;br /&gt;
&lt;br /&gt;
====Behaviors to Verify====&lt;br /&gt;
&lt;br /&gt;
For the copied assignment, we need to verify if:&lt;br /&gt;
&lt;br /&gt;
1. All the submission records are copied from the old assignment to the new assignment. &lt;br /&gt;
&lt;br /&gt;
2. Extra participants are copied.&lt;br /&gt;
&lt;br /&gt;
3. All review responses are copied.&lt;br /&gt;
&lt;br /&gt;
===Manual UI Testing===&lt;br /&gt;
&lt;br /&gt;
This feature is accessible only by an instructor.&lt;br /&gt;
&lt;br /&gt;
1. Log in as an instructor.&lt;br /&gt;
&lt;br /&gt;
2. Go to Assignments and select an existing assignment. &lt;br /&gt;
&lt;br /&gt;
3. Make sure that the assignment has a calibration tab since this feature handles only calibration assignments. &lt;br /&gt;
&lt;br /&gt;
4. Click on the copy option next to the assignment name and this creates a copy of the assignment and a number is appended to the name in order to name the new copied assignment. &lt;br /&gt;
&lt;br /&gt;
5. After the successful implementation of the feature, you should be able to click on the calibration tab of the copied assignment and this should enlist all the participants, submissions, and reviews.&lt;br /&gt;
&lt;br /&gt;
6. This shows that the feature of copying submissions from old calibration assignments to new calibration assignments was successful.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146689</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146689"/>
		<updated>2022-11-16T01:25:00Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
They created a new class method that checks if the an assignment was calibrated and if it was, it calls methods from models. It performs the following:&lt;br /&gt;
&lt;br /&gt;
  1. They copy all submission records with the assignment_id matching the original assignment. &lt;br /&gt;
  2. Copy all participants with the parent_id matching the original assignment ID.    &lt;br /&gt;
  3. Copy all the teams with a parent_id matching the original assignment ID.  &lt;br /&gt;
  4. Recreated mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
    4.1. Their copy methods for teams and participants return hash maps that are used to lookup previous mappings.&lt;br /&gt;
      4.1.1. Create new TeamsUsers.  Associates participants with teams.  &lt;br /&gt;
      4.1.2. Create new ReviewResponseMap.  Associates reviewers and reviewees, linked to an assignment, together.  &lt;br /&gt;
  5. Copy all review_responses, using the original review response map as the reference.  &lt;br /&gt;
&lt;br /&gt;
Their 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (to avoid creating new records).  &lt;br /&gt;
&lt;br /&gt;
They also added methods for copy naming schemes so that the assignment model validates uniqueness of both the assignment name and directory_path.&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
'''Issue 1: To set up calibration, the instructor (or TA) adds a few extra participants to the assignment.  The instructor (or TA) then impersonates the extra participants, and submits work on behalf of each of the extra participants.''' - &lt;br /&gt;
&lt;br /&gt;
  This is extra trouble. An instructor needn't have to resubmit the same calibration submissions every semester.&lt;br /&gt;
&lt;br /&gt;
'''Issue 2: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
  self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
'''Issue 3: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
  self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
'''Issue 4: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
  Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
'''Issue 5: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
  New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
''' Issue 6: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
'''assignment_form.rb'''&lt;br /&gt;
  Added a new method &amp;quot;copy_name&amp;quot; to name copied assignments. Where they changed the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot;, etc to &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot;&lt;br /&gt;
  Added new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
'''participant.rb'''&lt;br /&gt;
  Wrote a &amp;quot;createparticipant&amp;quot; method in assignment_participant in place of a similar method in participant.rb&lt;br /&gt;
&lt;br /&gt;
'''response.rb'''&lt;br /&gt;
  Implemented a method for copying previous responses &lt;br /&gt;
&lt;br /&gt;
'''response_map.rb'''&lt;br /&gt;
  Implemented a method to create ReviewResponse mapping based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
'''submission_record.rb'''&lt;br /&gt;
  Added method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''teams_user.rb'''&lt;br /&gt;
  Added a method to create new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&lt;br /&gt;
'''assignment_participant.rb'''&lt;br /&gt;
  Added a method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146680</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146680"/>
		<updated>2022-11-16T00:32:56Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Submission ==&lt;br /&gt;
&lt;br /&gt;
=== What was Done ===&lt;br /&gt;
&lt;br /&gt;
=== Issues ===&lt;br /&gt;
&lt;br /&gt;
=== Files Changed ===&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1: To set up calibration, the instructor (or TA) adds a few extra participants to the assignment.  The instructor (or TA) then impersonates the extra participants, and submits work on behalf of each of the extra participants.''' - &lt;br /&gt;
&lt;br /&gt;
This is extra trouble. An instructor needn't have to resubmit the same calibration submissions every semester.&lt;br /&gt;
&lt;br /&gt;
* '''Issue 2: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
* '''Issue 3: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
* '''Issue 4: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
* '''Issue 5: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
*''' Issue 6: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Changed Files ===&lt;br /&gt;
&lt;br /&gt;
1. app/assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
2. app/controllers/assessment360_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. app/controllers/review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
4. app/models/assignment_participant.rb&lt;br /&gt;
&lt;br /&gt;
5. app/models/metareview_questionnaire.rb&lt;br /&gt;
&lt;br /&gt;
6. app/models/vm_question_response.rb&lt;br /&gt;
&lt;br /&gt;
7. app/views/assessment360/all_students_all_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
8. app/views/assessment360/index.html.erb&lt;br /&gt;
&lt;br /&gt;
9. config/routes.rb&lt;br /&gt;
&lt;br /&gt;
10. lib/average.rb&lt;br /&gt;
&lt;br /&gt;
11. spec/controllers/assessment360_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
12. spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
13. spec/models/assignment_participant_spec.rb&lt;br /&gt;
&lt;br /&gt;
14. spec/models/student_task_spec.rb&lt;br /&gt;
&lt;br /&gt;
15. spec/models/vm_question_response_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146428</id>
		<title>CSC/ECE 517 Fall 2022 - E2284. Calibration submissions should be copied along with calibration assignments</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2284._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=146428"/>
		<updated>2022-11-14T21:52:36Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Minor Refactoring&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
A “calibration assignment” is an assignment where the students are asked to review work that has also been reviewed by a member of the course staff.  If the student’s review “resembles” the staff member’s review, then the student is presumed to be a competent reviewer.  Here is a further description of calibration assignments. The instructor (or TA) adds a few extra participants to the assignment to set up calibration.  The instructor (or TA) then impersonates the extra participants and submits work on behalf of each of the extra participants.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
Having the instructor (or TA) impersonate the extra participants, and submit work on behalf of each of the extra participants is extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  Copying the extra participants along with their teams, submissions, and responses when copying an assignment makes things much easier.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementation ==&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1: To set up calibration, the instructor (or TA) adds a few extra participants to the assignment.  The instructor (or TA) then impersonates the extra participants, and submits work on behalf of each of the extra participants.''' - &lt;br /&gt;
&lt;br /&gt;
This is extra trouble. An instructor needn't have to resubmit the same calibration submissions every semester.&lt;br /&gt;
&lt;br /&gt;
* '''Issue 2: Not all uses of class methods are good. '''&lt;br /&gt;
&lt;br /&gt;
self.copy_participants_for_assignment: copies old participants to new --&amp;gt; assignment_participant.rb, it is in teams_users.rb, which seems misplaced.&lt;br /&gt;
&lt;br /&gt;
* '''Issue 3: Returns a mapping from the old response map to the new response map.&lt;br /&gt;
&lt;br /&gt;
self.copy_review_response_map, returns a mapping from the old response map to the new response map. It is in review_response_map.rb. This can be an instance method. There is a copy_review_responses in this class too. &lt;br /&gt;
&lt;br /&gt;
* '''Issue 4: Code missing without causing a bug&lt;br /&gt;
&lt;br /&gt;
Line 65 of submit_hyperlink has missing code.&lt;br /&gt;
&lt;br /&gt;
* '''Issue 5: Old code not reused.'''&lt;br /&gt;
&lt;br /&gt;
New code was written to copy a team in teams_user.rb. There already exists code to copy a team.&lt;br /&gt;
&lt;br /&gt;
*''' Issue 6: No Automated tests written'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Changed Files ===&lt;br /&gt;
&lt;br /&gt;
1. app/assets/javascripts/tree_display.jsx&lt;br /&gt;
&lt;br /&gt;
2. app/controllers/assessment360_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. app/controllers/review_mapping_controller.rb&lt;br /&gt;
&lt;br /&gt;
4. app/models/assignment_participant.rb&lt;br /&gt;
&lt;br /&gt;
5. app/models/metareview_questionnaire.rb&lt;br /&gt;
&lt;br /&gt;
6. app/models/vm_question_response.rb&lt;br /&gt;
&lt;br /&gt;
7. app/views/assessment360/all_students_all_reviews.html.erb&lt;br /&gt;
&lt;br /&gt;
8. app/views/assessment360/index.html.erb&lt;br /&gt;
&lt;br /&gt;
9. config/routes.rb&lt;br /&gt;
&lt;br /&gt;
10. lib/average.rb&lt;br /&gt;
&lt;br /&gt;
11. spec/controllers/assessment360_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
12. spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
13. spec/models/assignment_participant_spec.rb&lt;br /&gt;
&lt;br /&gt;
14. spec/models/student_task_spec.rb&lt;br /&gt;
&lt;br /&gt;
15. spec/models/vm_question_response_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals ===&lt;br /&gt;
&lt;br /&gt;
  The main goal of our testing is to ensure that when a new calibration assignment is added, all of the qualifying previous calibration submissions &lt;br /&gt;
  and reviews are successfully copied over without overwriting any existing submissions.&lt;br /&gt;
&lt;br /&gt;
=== Automated Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Team Information ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Dr. Ed Gehringer (efg@ncsu.edu)&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
Pradyumna Khawas (ppkhawas@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Abhimanyu Bellam (abellam2@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Vishnu Vinod Erapalli (verapal@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Development:Setup:Linux:Debian&amp;diff=146264</id>
		<title>Development:Setup:Linux:Debian</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Development:Setup:Linux:Debian&amp;diff=146264"/>
		<updated>2022-11-06T20:24:36Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Updating Ruby version from 2.1.5 to 2.3.1 (version used in production)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Prerequisites==&lt;br /&gt;
* You must have shell access&lt;br /&gt;
* You must have root access (via sudo), or the required software must already be installed&lt;br /&gt;
==Install Git==&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;sudo apt-get install git curl&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Get Expertiza==&lt;br /&gt;
====Expertiza Repository URLs====&lt;br /&gt;
* (ssh, read/write) git@github.com:expertiza/expertiza.git&lt;br /&gt;
* (https, read/write) https://github.com/expertiza/expertiza.git&lt;br /&gt;
* (git, read-only) git://github.com/expertiza/expertiza.git&lt;br /&gt;
====Default====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;git clone &amp;lt;remote&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;git clone git@github.com:expertiza/expertiza.git&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Options====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;git clone -b &amp;lt;branch&amp;gt; &amp;lt;remote&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;git clone -b production git@github.com:expertiza/expertiza.git&amp;lt;/pre&amp;gt;&lt;br /&gt;
====To Rename the Central Remote====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;git remote rename &amp;lt;current_name&amp;gt; &amp;lt;desired_name&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;git remote rename origin upstream&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install RVM==&lt;br /&gt;
[https://rvm.io/rvm/install/ RVM Install]&lt;br /&gt;
====Single User Mode (Recommended)====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;\curl -L https://get.rvm.io | bash -s stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
=====Load RVM as a Function=====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;source ~/.rvm/scripts/rvm&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Multi User Mode (Not Recommended)====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;\curl -L https://get.rvm.io | sudo bash -s stable&amp;lt;/pre&amp;gt;&lt;br /&gt;
=====Load RVM as a Function=====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;source /etc/profile&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Post-Installation====&lt;br /&gt;
=====Is RVM a Function?=====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;$ type rvm | head -1&lt;br /&gt;
rvm is a shell function&amp;lt;/pre&amp;gt;&lt;br /&gt;
If not, try loading RVM as a function again. If it is still not a function, try reinstalling RVM.&lt;br /&gt;
&lt;br /&gt;
=====Make sure all the dependencies are met for RVM=====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rvm requirements&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will show a yum command. Run it to install the dependancies for Ruby.&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Ruby v. 2.3.1==&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rvm install 2.3.1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rvm use 2.3.1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Create Expertiza Gemset (optional)==&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rvm use 2.3.1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rvm gemset create expertiza&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rvm use 2.3.1@expertiza&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Create a .rvmrc File (optional)====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;echo 'rvm use 2.3.1@expertiza' &amp;gt; .rvmrc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Native Expertiza Dependencies==&lt;br /&gt;
Dependencies are for the gems raspell, rjb, nokogiri, and mysql.&lt;br /&gt;
You may be prompted multiple times to set a root password for mysql. This password is up to you, but it can be left blank.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;sudo apt-get install openjdk-6-jre-headless openjdk-6-source mysql-client mysql-server libmysqlclient-dev libaspell-dev libpq-dev&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Bundled Gems==&lt;br /&gt;
Set JAVA_HOME for the rjb gem:&lt;br /&gt;
Your path may be different. You can generally find out the path by looking at the symbolic link at /etc/alternatives/java&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;ls -la /etc/alternatives/java&amp;lt;/pre&amp;gt;&lt;br /&gt;
This outputs something like '/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java'. Only part of this path may need to be set to JAVA_HOME. In this instance, it is '/usr/lib/jvm/java-6-openjdk-amd64'.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;bundle install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Setup Redis==&lt;br /&gt;
Please install redis on your machine and then run redis-server command.&lt;br /&gt;
These commands will help you run redis easily:&lt;br /&gt;
$ wget http://download.redis.io/releases/redis-4.0.1.tar.gz&lt;br /&gt;
$ tar xzf redis-4.0.1.tar.gz&lt;br /&gt;
$ cd redis-4.0.1&lt;br /&gt;
$ make&lt;br /&gt;
$ src/redis-server&lt;br /&gt;
&lt;br /&gt;
==Set Up the Database==&lt;br /&gt;
====Enable and Start the MySql Daemon====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;sudo service mysqld enable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;sudo service mysqld start&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Set the MySql Root Password====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;mysqladmin -u root password&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Automatic Configuration===&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;mysql -uroot &amp;lt; db/grant_expertiza.sql&amp;lt;/pre&amp;gt;&lt;br /&gt;
===Manual Configuration===&lt;br /&gt;
====Log in to MySql====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;mysql -uroot -p&amp;lt;/pre&amp;gt;&lt;br /&gt;
The following commands are executed inside mysql&lt;br /&gt;
====Create the Expertiza User====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;create user expertiza@localhost;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create the Databases====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;create database pg_development;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;create database pg_test;&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Grant Privileges to the Expertiza User====&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;grant all on pg_development.* to expertiza@localhost;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;grant all on pg_test.* to expertiza@localhost;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Build the Expertiza Database==&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rake db:migrate&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;rake db:test:prepare&amp;lt;/pre&amp;gt;&lt;br /&gt;
====Import Production Data (Optional)====&lt;br /&gt;
This step requires that you have your ssh private/public key pairs loaded in the production server under the rails user.&amp;lt;br /&amp;gt;&lt;br /&gt;
[[How to Add SSH Keys to the Expertiza Production Server]] &amp;lt;br /&amp;gt;&lt;br /&gt;
You must run the following command from your local Expertiza project directory.&lt;br /&gt;
&amp;lt;pre style=&amp;quot;white-space:normal;&amp;quot;&amp;gt;cap load_production_data&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2252._Refactor_auth_controller.rb_%26_password_retrieval_controller.rb&amp;diff=145933</id>
		<title>CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb &amp; password retrieval controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2252._Refactor_auth_controller.rb_%26_password_retrieval_controller.rb&amp;diff=145933"/>
		<updated>2022-10-26T07:04:35Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: /* Changes to spec/controllers/password_retrieval_controller_spec.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview of Expertiza ==&lt;br /&gt;
Expertiza is an open source software written using Ruby on Rails which functions as a learning management software system. It has man different functions and abilities including the ability to create assignments, quizzes, assignment groups and topics, and also a complete mechanism for providing peer reviews and feedback for other groups and other teammates. Part of its functionality is a system for user authentication with different user roles and permissions that determine how each user interacts with the content. The &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt; which are the files primarily addressed in this project are both critical controllers in providing this functionality.&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
TODO: Describe the objectives of the project and what issues we were attempting to address.&lt;br /&gt;
&amp;lt;code&amp;gt;auth_controller&amp;lt;/code&amp;gt; is used for authentication purposes. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;password_retrieval_controller&amp;lt;/code&amp;gt; deals with the process of updating and resetting a user password. The &amp;lt;code&amp;gt;send_password&amp;lt;/code&amp;gt; method generates a token and appends it to a password reset URL. If a user submits a valid email address on the &amp;lt;code&amp;gt;password_retrieval/forgotten&amp;lt;/code&amp;gt; view, the URL is sent to the user's email. When a user goes to the password reset URL, the token parameter is decrypted and checked for expiration. Next, the &amp;lt;code&amp;gt;password_retrieval/reset_password&amp;lt;/code&amp;gt; view is loaded where a user enters an updated password and is sent back to the home page. In this project, the method was refactored in the following ways: to adhere to DRY principles, removal of hardwired constants, renaming of methods and variables, and enhanced comments. In addition, RSpec testing coverage of the controller was improved from 63.33% to 91.8% through a series of new tests that primarily look at the &amp;lt;code&amp;gt;update_password&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
== Files Modified ==&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;app/controllers/password_retrieval_controller.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Updated &amp;lt;code&amp;gt;check_reset_url&amp;lt;/code&amp;gt; method name to &amp;lt;code&amp;gt;check_token_validity&amp;lt;/code&amp;gt;&lt;br /&gt;
|The method validates that the password reset token is valid and present. The updated method name provides a more functionally descriptive name. &lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Replaced repeated code in lines 35-36 and 62-63&lt;br /&gt;
|The use of repeated code violates the DRY principle and so it was moved to a new method.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/5429abd6fcb39f7bdbb0aaa1813f19c8101d7e25 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Change token expiration time to constant in line 41&lt;br /&gt;
|This time should not be hardwired; it should be a constant or a parameter. &lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/3f0b51f6f2f106df8338483396a95d4068e39c7f Commit]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Reload page if email is nil or empty on &amp;lt;code&amp;gt;password_retrieval/forgotten&amp;lt;/code&amp;gt; view&lt;br /&gt;
|An empty email parameter was causing the send password button to freeze.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/70f77ac851b234f840709859dc1ee9d6725c34fc Commit]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Improve overall comments and rewrite error messages&lt;br /&gt;
|The comments and error messages in the controller need to be more meaningful, specific and clear.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/1af745dc3b59641cb0266ebe49ee996718381fd0 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;spec/controllers/password_retrieval_controller_spec.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Added two new RSpec tests for the &amp;lt;code&amp;gt;update_password&amp;lt;/code&amp;gt; method&lt;br /&gt;
|There were no tests for the &amp;lt;code&amp;gt;update_password&amp;lt;/code&amp;gt; method. We wanted to enhance the test suite of this controller by increasing the coverage of its Rspec tests.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/a90b1aada9878c7cdf7319dd022432cca8eadd2f Commit]&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Added two new RSpec tests for the &amp;lt;code&amp;gt;send_password&amp;lt;/code&amp;gt; method to check nil or blank input for email&lt;br /&gt;
|There were no tests for the &amp;lt;code&amp;gt;send_password&amp;lt;/code&amp;gt; method pertaining to checking invalid inputs in the request params&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/1d2d2d94ef730ab427bb326049bc5ec800a0dfc9 Commit]&amp;lt;br&amp;gt;[https://github.com/greyfiles/expertiza/commit/781d6f42ca37829e0e514de8bcef1c85b2a035a2 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Updated URL path and controller action to updated method name &amp;lt;code&amp;gt;check_token_validity&amp;lt;/code&amp;gt;&lt;br /&gt;
|The action and URL path must be renamed to generate pathing to the controller method and views.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;app/controllers/auth_controller.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Move logger messages to &amp;lt;code&amp;gt;before_action&amp;lt;/code&amp;gt; blocks wherever possible&lt;br /&gt;
|Logger messages are inserted to log important events occurring in the code and do not relate directly to the logic. When possible, moving them to either &amp;lt;code&amp;gt;before_action&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;after_action&amp;lt;/code&amp;gt; blocks makes the code more readable and easier to understand. It also separates the functionality of the method itself and the logging functionality.&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/7069f5d3cbfa2b7259e85e39dbfbf6fb41a0ce1d Commit]&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Replaced repeated code for re-caching the user role&lt;br /&gt;
|We noticed that although not listed on the recommended changes, this action involved exactly repeated code in the controller. The use of repeated code violates the DRY principle and so it was moved to a new method called &amp;lt;code&amp;gt;self.rebuild_role_cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/9ef20cffa0fe7b8440b97856a6db4b5351eece35 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Improved helper function names&lt;br /&gt;
|Originally we made the new helper functions used in logging have unhelpful, confusing names. Making them more clear helps the code to be more understandable.&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/32f8435255add7b44b38fd747f81f435d331d14d Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
TODO: Show how the existing testing suite was passing before and after our refactoring - preserving functionality.&lt;br /&gt;
&lt;br /&gt;
=== Testing &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
Before any refactoring to auth_controller.rb was done, we ran the rspec tests created for the controller with the following command: rspec spec/controllers/password_retrieval_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:before_refactor_password_retrieval_controller.png|center|frame|rspec tests all passing before the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
Tests prior to the changes covered 63.3% of &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
[[File:E2252_password_retrieval_coverage_report_before.png|center|frame|rspec test coverage report before the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
After adding tests, the tests covered 91.1% of &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
[[File:E2252_password_retrieval_coverage_report_after.png|center|frame|rspec test coverage report after the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
=== Testing &amp;lt;code&amp;gt;auth_controller_.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
Before any refactoring to &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt; was done, we ran the rspec tests created for the controller with the following command: &amp;lt;code&amp;gt;rspec spec/controllers/auth_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:before_refactor_auth_controller.png|center|frame|rspec tests all passing before the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
After making all of the above changes to &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt;, we ran the rspec tests for the controller again with the command: &amp;lt;code&amp;gt;rspec spec/controllers/auth_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:after_refactor_auth_controller.png|center|frame|rspec tests continuing to all pass after completing the refactoring]]&lt;br /&gt;
&lt;br /&gt;
We have successfully preserved the passing tests after the improvements we made to the &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/greyfiles/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2460&lt;br /&gt;
* '''VCL Server:''' http://152.7.98.115:8080/&lt;br /&gt;
&lt;br /&gt;
== Contributors to this project ==&lt;br /&gt;
* Grey Files (unityid: mgfiles, github: greyfiles)&lt;br /&gt;
* Colin Odowd (unityid: cdodowd, github: colin-odowd)&lt;br /&gt;
* Pradyumna Khawas (unityid: ppkhawas, github: therealppk)&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2252._Refactor_auth_controller.rb_%26_password_retrieval_controller.rb&amp;diff=145932</id>
		<title>CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb &amp; password retrieval controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2022_-_E2252._Refactor_auth_controller.rb_%26_password_retrieval_controller.rb&amp;diff=145932"/>
		<updated>2022-10-26T06:41:32Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: Added Rspec Coverage Reports&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview of Expertiza ==&lt;br /&gt;
Expertiza is an open source software written using Ruby on Rails which functions as a learning management software system. It has man different functions and abilities including the ability to create assignments, quizzes, assignment groups and topics, and also a complete mechanism for providing peer reviews and feedback for other groups and other teammates. Part of its functionality is a system for user authentication with different user roles and permissions that determine how each user interacts with the content. The &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt; which are the files primarily addressed in this project are both critical controllers in providing this functionality.&lt;br /&gt;
== Description of Project ==&lt;br /&gt;
TODO: Describe the objectives of the project and what issues we were attempting to address.&lt;br /&gt;
&amp;lt;code&amp;gt;auth_controller&amp;lt;/code&amp;gt; is used for authentication purposes. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;password_retrieval_controller&amp;lt;/code&amp;gt; deals with the process of updating and resetting a user password. The &amp;lt;code&amp;gt;send_password&amp;lt;/code&amp;gt; method generates a token and appends it to a password reset URL. If a user submits a valid email address on the &amp;lt;code&amp;gt;password_retrieval/forgotten&amp;lt;/code&amp;gt; view, the URL is sent to the user's email. When a user goes to the password reset URL, the token parameter is decrypted and checked for expiration. Next, the &amp;lt;code&amp;gt;password_retrieval/reset_password&amp;lt;/code&amp;gt; view is loaded where a user enters an updated password and is sent back to the home page. In this project, the method was refactored in the following ways: to adhere to DRY principles, removal of hardwired constants, renaming of methods and variables, and enhanced comments. In addition, RSpec testing coverage of the controller was improved from 63.33% to 91.8% through a series of new tests that primarily look at the &amp;lt;code&amp;gt;update_password&amp;lt;/code&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
== Files Modified ==&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;app/controllers/password_retrieval_controller.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Updated &amp;lt;code&amp;gt;check_reset_url&amp;lt;/code&amp;gt; method name to &amp;lt;code&amp;gt;check_token_validity&amp;lt;/code&amp;gt;&lt;br /&gt;
|The method validates that the password reset token is valid and present. The updated method name provides a more functionally descriptive name. &lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Replaced repeated code in lines 35-36 and 62-63&lt;br /&gt;
|The use of repeated code violates the DRY principle and so it was moved to a new method.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/5429abd6fcb39f7bdbb0aaa1813f19c8101d7e25 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Change token expiration time to constant in line 41&lt;br /&gt;
|This time should not be hardwired; it should be a constant or a parameter. &lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/3f0b51f6f2f106df8338483396a95d4068e39c7f Commit]&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Reload page if email is nil or empty on &amp;lt;code&amp;gt;password_retrieval/forgotten&amp;lt;/code&amp;gt; view&lt;br /&gt;
|An empty email parameter was causing the send password button to freeze.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/70f77ac851b234f840709859dc1ee9d6725c34fc Commit]&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Improve overall comments and rewrite error messages&lt;br /&gt;
|The comments and error messages in the controller need to be more meaningful, specific and clear.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/1af745dc3b59641cb0266ebe49ee996718381fd0 Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;spec/controllers/password_retrieval_controller_spec.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Added two new RSpec tests for the &amp;lt;code&amp;gt;update_password&amp;lt;/code&amp;gt; method&lt;br /&gt;
|There were no tests for the &amp;lt;code&amp;gt;update_password&amp;lt;/code&amp;gt; method. We wanted to enhance the test suite of this controller by increasing the coverage of its Rspec tests.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/a90b1aada9878c7cdf7319dd022432cca8eadd2f Commit]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;config/routes.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Updated URL path and controller action to updated method name &amp;lt;code&amp;gt;check_token_validity&amp;lt;/code&amp;gt;&lt;br /&gt;
|The action and URL path must be renamed to generate pathing to the controller method and views.&lt;br /&gt;
|[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Changes to &amp;lt;code&amp;gt;app/controllers/auth_controller.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%;&lt;br /&gt;
! &amp;amp;nbsp;#&amp;amp;nbsp; !! Change !! Rationale !! Commit Link&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Move logger messages to &amp;lt;code&amp;gt;before_action&amp;lt;/code&amp;gt; blocks wherever possible&lt;br /&gt;
|Logger messages are inserted to log important events occurring in the code and do not relate directly to the logic. When possible, moving them to either &amp;lt;code&amp;gt;before_action&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;after_action&amp;lt;/code&amp;gt; blocks makes the code more readable and easier to understand. It also separates the functionality of the method itself and the logging functionality.&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/7069f5d3cbfa2b7259e85e39dbfbf6fb41a0ce1d Commit]&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Replaced repeated code for re-caching the user role&lt;br /&gt;
|We noticed that although not listed on the recommended changes, this action involved exactly repeated code in the controller. The use of repeated code violates the DRY principle and so it was moved to a new method called &amp;lt;code&amp;gt;self.rebuild_role_cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/9ef20cffa0fe7b8440b97856a6db4b5351eece35 Commit]&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Improved helper function names&lt;br /&gt;
|Originally we made the new helper functions used in logging have unhelpful, confusing names. Making them more clear helps the code to be more understandable.&lt;br /&gt;
|[https://github.com/greyfiles/expertiza/commit/32f8435255add7b44b38fd747f81f435d331d14d Commit]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
TODO: Show how the existing testing suite was passing before and after our refactoring - preserving functionality.&lt;br /&gt;
&lt;br /&gt;
=== Testing &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
Before any refactoring to auth_controller.rb was done, we ran the rspec tests created for the controller with the following command: rspec spec/controllers/password_retrieval_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
[[File:before_refactor_password_retrieval_controller.png|center|frame|rspec tests all passing before the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
Tests prior to the changes covered 63.3% of &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
[[File:E2252_password_retrieval_coverage_report_before.png|center|frame|rspec test coverage report before the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
After adding tests, the tests covered 91.1% of &amp;lt;code&amp;gt;password_retrieval_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
[[File:E2252_password_retrieval_coverage_report_after.png|center|frame|rspec test coverage report after the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
=== Testing &amp;lt;code&amp;gt;auth_controller_.rb&amp;lt;/code&amp;gt; ===&lt;br /&gt;
Before any refactoring to &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt; was done, we ran the rspec tests created for the controller with the following command: &amp;lt;code&amp;gt;rspec spec/controllers/auth_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:before_refactor_auth_controller.png|center|frame|rspec tests all passing before the refactoring was completed]]&lt;br /&gt;
&lt;br /&gt;
After making all of the above changes to &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt;, we ran the rspec tests for the controller again with the command: &amp;lt;code&amp;gt;rspec spec/controllers/auth_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:after_refactor_auth_controller.png|center|frame|rspec tests continuing to all pass after completing the refactoring]]&lt;br /&gt;
&lt;br /&gt;
We have successfully preserved the passing tests after the improvements we made to the &amp;lt;code&amp;gt;auth_controller.rb&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/greyfiles/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2460&lt;br /&gt;
* '''VCL Server:''' http://152.7.98.115:8080/&lt;br /&gt;
&lt;br /&gt;
== Contributors to this project ==&lt;br /&gt;
* Grey Files (unityid: mgfiles, github: greyfiles)&lt;br /&gt;
* Colin Odowd (unityid: cdodowd, github: colin-odowd)&lt;br /&gt;
* Pradyumna Khawas (unityid: ppkhawas, github: therealppk)&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2252_password_retrieval_coverage_report_after.png&amp;diff=145931</id>
		<title>File:E2252 password retrieval coverage report after.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2252_password_retrieval_coverage_report_after.png&amp;diff=145931"/>
		<updated>2022-10-26T06:38:53Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: The picture shows the coverage report after committing changes (E2252) to password_retrieval_controller.rb.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The picture shows the coverage report after committing changes (E2252) to password_retrieval_controller.rb.&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2252_password_retrieval_coverage_report_before.png&amp;diff=145929</id>
		<title>File:E2252 password retrieval coverage report before.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2252_password_retrieval_coverage_report_before.png&amp;diff=145929"/>
		<updated>2022-10-26T06:37:56Z</updated>

		<summary type="html">&lt;p&gt;Ppkhawas: The picture shows the coverage report before committing changes to password_retrieval_controller.rb.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The picture shows the coverage report before committing changes to password_retrieval_controller.rb.&lt;/div&gt;</summary>
		<author><name>Ppkhawas</name></author>
	</entry>
</feed>