<?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=Lmcampb5</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=Lmcampb5"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Lmcampb5"/>
	<updated>2026-08-06T16:12:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145566</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145566"/>
		<updated>2022-04-30T18:38:21Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found [https://youtu.be/RIsVKTDc5J0 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145565</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145565"/>
		<updated>2022-04-30T15:05:23Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145564</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145564"/>
		<updated>2022-04-30T15:03:19Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]]&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145563</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145563"/>
		<updated>2022-04-30T15:02:59Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]]&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]]&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145562</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145562"/>
		<updated>2022-04-30T15:02:24Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145561</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145561"/>
		<updated>2022-04-30T15:01:31Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br /&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145560</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145560"/>
		<updated>2022-04-30T14:59:32Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145559</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145559"/>
		<updated>2022-04-30T14:58:45Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145558</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145558"/>
		<updated>2022-04-30T14:58:13Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Conclusion  */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
The calibration tab, in the assignment edit view, appears identical to the copied assignment.  &lt;br /&gt;
&lt;br /&gt;
*Future Considerations&lt;br /&gt;
** submitter_count, a field in the [https://expertiza.csc.ncsu.edu/index.php/Assignments assignments table] is not dealt with in our implementation.  Interestingly, the existing 'Design exercise' assignment used for testing had a submitter_count of 0 the database.&lt;br /&gt;
** Directory paths for submissions are still not explicitly considered.  &lt;br /&gt;
** Additional rspec tests should be created.  An easy test would be to check response_maps for the new assignment after calling the copy method and verifying the same number of records exist.&lt;br /&gt;
** Several database queries are performed in each of our methods.  Performance improvements could likely be made by considering another strategy.&lt;br /&gt;
** Our copy naming methods are identical, the only difference being the assignment field used to check for name uniqueness (assignment name vs directory path).  We couldn't figure out how to consolidate this to a single method (how can you pass a attribute/field type to a method?)&lt;br /&gt;
** More defensive programming could be done, i.e. when we copy records, we don't check whether saving the new record is successful.  If we did check and a copy failed to save, what should be done?&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145557</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145557"/>
		<updated>2022-04-30T14:46:00Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Conclusion  */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Calibration_copy_testing.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Calibration_copy_testing.PNG&amp;diff=145556</id>
		<title>File:Calibration copy testing.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Calibration_copy_testing.PNG&amp;diff=145556"/>
		<updated>2022-04-30T14:45:52Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145555</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145555"/>
		<updated>2022-04-30T14:41:09Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Conclusion  */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Test_expertiza_calibration_copy.PNG]]&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Test_expertiza_calibration_copy.PNG&amp;diff=145554</id>
		<title>File:Test expertiza calibration copy.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Test_expertiza_calibration_copy.PNG&amp;diff=145554"/>
		<updated>2022-04-30T14:40:37Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145553</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145553"/>
		<updated>2022-04-30T14:39:52Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Conclusion  */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
Our testing was all manual testing.  Like the old team, we used the assignment titled &amp;quot;Design exercise&amp;quot; from the expertiza_development database, while logged in as instructor6 to verify our implementation.&lt;br /&gt;
&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145552</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145552"/>
		<updated>2022-04-30T14:34:39Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Final 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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews' is called in the existing assignment_form class method 'copy', if the copied assignment is able to be saved (we don't want to create all of these new records pointlessly).  &lt;br /&gt;
&lt;br /&gt;
We also added methods for copy naming schemes.  This is needed because the assignment model validates uniqueness of both the assignment name and directory_path.&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145551</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145551"/>
		<updated>2022-04-30T14:29:47Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Final 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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method, if the original assignment was calibrated, calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.  If the original assignment is not calibrated, this method does nothing.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&lt;br /&gt;
* We copy all teams with a parent_id matching the original assignment ID.  See [https://expertiza.csc.ncsu.edu/index.php/Teams teams database documentation]&lt;br /&gt;
* We recreate mappings needed to associate participants with teams and review_response maps.&lt;br /&gt;
** Our teams and participants copy methods return hash maps that are used to lookup previous mappings.  For each new team and participant, we can lookup how the original records were mapped&lt;br /&gt;
*** Create new TeamsUsers.  This associates participants with teams.  See [https://expertiza.csc.ncsu.edu/index.php/Teams_users teams users database documentation]&lt;br /&gt;
*** Create new ReviewResponseMap.  This is a type of response map that associates reviewers and reviewees, linked to an assignment, together.  See [https://expertiza.csc.ncsu.edu/index.php/Response_maps response map database documentation]&lt;br /&gt;
* We copy all review_responses, using the original review response map as a reference.  See [https://expertiza.csc.ncsu.edu/index.php/Responses response database documentation]&lt;br /&gt;
&lt;br /&gt;
Our new 'copy_calibrated_reviews&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145550</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145550"/>
		<updated>2022-04-30T14:21:26Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Final 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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
We implemented a new class method, 'copy_calibrated_reviews', in the assignment_form model.  This method calls methods in models listed in previous section to copy all objects needed to recreate calibrated reviews.&lt;br /&gt;
* We copy all submission records with assignment_id matching the original assignment.  See [https://expertiza.csc.ncsu.edu/index.php/Submission_records submission record database documentation]&lt;br /&gt;
* We copy all participants with parent_id matching the original assignment ID.  We did this in the participant model but should have moved it to assignment_participant since we are not interested in course participants.  See [https://expertiza.csc.ncsu.edu/index.php/Participants participant database documentation]&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145549</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145549"/>
		<updated>2022-04-30T14:13:17Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating 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;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145548</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145548"/>
		<updated>2022-04-30T14:12:03Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145547</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145547"/>
		<updated>2022-04-30T14:11:00Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
**Implement new method for copying objects needed to recreate calibration reviews&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* response.rb&lt;br /&gt;
** Implement method for copying previous responses&lt;br /&gt;
* response_map.rb&lt;br /&gt;
** Implement method that creates ReviewResponse mapping, based on mapping of copied assignment&lt;br /&gt;
* submission_record.rb&lt;br /&gt;
** Implement method for copying submission records of an assignment&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies all teams of a previous assignment&lt;br /&gt;
* teams_user.rb&lt;br /&gt;
** Create method for creating new teams_users so that new participants and teams are associated the same way they were for the previous assignment&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
** Method for copying extra participants should be here, we wouldn't need to copy participants with type 'CourseParticipant'&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145546</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145546"/>
		<updated>2022-04-30T14:03:46Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* What needs to be done */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?: Can check 'calibrate_to' field in response maps where 'reviewed_object_id' equals the assignment ID being copied&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies the field used by all teams&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
** Write the create method to create the extra participants.&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145545</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145545"/>
		<updated>2022-04-30T13:55:04Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Problem Statement */&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. 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;
== '''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;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies the field used by all teams&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
** Write the create method to create the extra participants.&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145544</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145544"/>
		<updated>2022-04-30T13:41:42Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&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. 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;
== '''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 obviously extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies the field used by all teams&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
** Write the create method to create the extra participants.&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found [https://github.com/expertiza/expertiza/pull/2403 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145543</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=145543"/>
		<updated>2022-04-30T13:41:17Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&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. 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;
== '''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 obviously extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
Shown below is a diagram of how the current system works (copying the extra participants/reviews):&lt;br /&gt;
[[File:Calibration2.png|600px|left]]&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in &amp;lt;b&amp;gt;assignment_form.rb&amp;lt;/b&amp;gt; should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments - eg. a comment for a method that copies an assignment should not reveal details about calibrations. Currently, only 1/4 methods in this class have comments.&lt;br /&gt;
**Currently, for assignment_form.rb we change the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc. We will improve this by making it &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and putting this function in a new method.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;participant.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
**Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
*Clean up &amp;lt;b&amp;gt;team.rb&amp;lt;/b&amp;gt;&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
*Verify our work using not only user 'Instructor6' but also Professor Jennifer Kidd's account - 'Instructor 2026'&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
**Intead of setting the name of the copied assignments to “copy of copy” and &amp;quot;copy of copy of copy&amp;quot; etc, We will change it to name &amp;quot;Copy of &amp;lt;name&amp;gt; &amp;lt;copy number&amp;gt;&amp;quot; and put this function in a new method. &amp;lt;br/&amp;gt;This code currently resides in the self.copy method (which is too long and does too much for one method), so we will move it to a new method called copy_name.&lt;br /&gt;
**[[File:wiki1.png|800px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* participant.rb&lt;br /&gt;
** Write the create method in assignment_participant instead of directly in participant.rb&lt;br /&gt;
** Here is the current create method in participant.rb:&lt;br /&gt;
** [[File:wiki2.png|600px|left]] &amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
* team.rb&lt;br /&gt;
** Create a copy method in team.rb that copies the field used by all teams&lt;br /&gt;
* assignment_participant.rb&lt;br /&gt;
** Write the create method to create the extra participants.&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&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;
Using RSpec, we have to test that the following unit tests pass:&lt;br /&gt;
&lt;br /&gt;
  1. When the TA adds a calibration assignment, extra participants are added to the assignment.&lt;br /&gt;
&lt;br /&gt;
  2. When extra participants are added to an assignment, calibration submissions are copied over.&lt;br /&gt;
&lt;br /&gt;
  3. When calibration submissions are copied over, the submitter_count value increases by the number of calibration submissions, so that previous submissions are &lt;br /&gt;
     not overwritten.&lt;br /&gt;
&lt;br /&gt;
  4. After calibration assignments are copied over, only calibration reviews from the creator of the assignment are copied over.&lt;br /&gt;
&lt;br /&gt;
  5. After calibration assignments are copied over, only calibration reviews that have been started are copied over.&lt;br /&gt;
&lt;br /&gt;
  6. Calling specific methods in assignment.rb return a NoMethodError to indicate that these methods are no longer class methods and have been moved elsewhere as &lt;br /&gt;
     instance methods.&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to our pull request can be found here [https://github.com/expertiza/expertiza/pull/2403] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub pull request can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144497</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144497"/>
		<updated>2022-04-07T00:26:27Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* What needs to be done */&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. 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;
== '''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 obviously extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  &lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started --&amp;gt; how do you recognize a calibration review?&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in assignment_form.rb should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments&lt;br /&gt;
**Break out copy of new assignment name into a new method?  Change copy name i.e. “copy2” vs. “copy of copy”&lt;br /&gt;
*Clean up participant.rb&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
*Clean up team.rb&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* participant.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_team.rb&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144492</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144492"/>
		<updated>2022-04-07T00:20:03Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&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. 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;
== '''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 obviously extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  &lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started.&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in assignment_form.rb should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments&lt;br /&gt;
**Break out copy of new assignment name into a new method?  Change copy name i.e. “copy2” vs. “copy of copy”&lt;br /&gt;
*Clean up participant.rb&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
*Clean up team.rb&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* participant.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_team.rb&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144481</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144481"/>
		<updated>2022-04-07T00:10:15Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* What needs to be done */&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. 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;
== '''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 obviously extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  &lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
*Ensure what gets copied (when and how) is done properly&lt;br /&gt;
**Reviews done by the creator of the assignment are copied, but only reviews that have been started.&lt;br /&gt;
**If an author did any non-calibration reviews in the assignment being copied, those reviews would also be treated as calibration reviews&lt;br /&gt;
**Submitted files are copied too, but  if the calibration submissions are done as part of the COPYING of the assignment, they will necessarily use directories 0, 1,  &lt;br /&gt;
*Handling the case of students submitting assignments before calibration  assignments are done&lt;br /&gt;
**Project assumes that calibrations start at directory 0&lt;br /&gt;
**Not the case if any students submit before the calibration submissions are done&lt;br /&gt;
*Submitter_count needs to be set to the largest directory number that was used for calibration&lt;br /&gt;
**First student to submit will have their submission show up in the same directory with the first calibration submission&lt;br /&gt;
*Several class methods in assignment_form.rb should be moved to different classes as instance methods in those classes&lt;br /&gt;
**Add better comments&lt;br /&gt;
**Break out copy of new assignment name into a new method?  Change copy name i.e. “copy2” vs. “copy of copy”&lt;br /&gt;
*Clean up participant.rb&lt;br /&gt;
**Look for a more elegant way of  (self.create_participant) copying/creating of participants → DRY violation&lt;br /&gt;
*Clean up team.rb&lt;br /&gt;
**Create a copy method in team that copies the field used by all teams&lt;br /&gt;
**Rest of the stuff is just used by assignment teams (submitted hyperlinks etc.)&lt;br /&gt;
**Create a copy method and override  in assignment_team&lt;br /&gt;
*Reevaluate instance variables.  Are these needed, or could they be local variables instead?&lt;br /&gt;
*Look at editing out 9min video due to long waits for responses during copying&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144477</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144477"/>
		<updated>2022-04-07T00:06:43Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: &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. 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;
== '''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 obviously extra trouble. It would be nice if an instructor didn’t have to resubmit the same calibration submissions every semester.  &lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
The previous project did fully implement code that copies over the calibration submissions whenever a calibrated assignment is submitted. It was done by ensuring that when a assignment is copied that 1) the same extra participants as the assignment you are copying are used 2) the URLs and/or files that were submitted to the previous assignment are also copied and 3) the URLs and files are submitted to the assignment as well&lt;br /&gt;
&lt;br /&gt;
The previous implementation needs to be revisited and made more elegant.  A description of the needed refactoring and changes is below.&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144472</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144472"/>
		<updated>2022-04-06T23:59:44Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144471</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144471"/>
		<updated>2022-04-06T23:59:02Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [https://github.com/expertiza/expertiza here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM &lt;br /&gt;
here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144470</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144470"/>
		<updated>2022-04-06T23:58:22Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
A link to the Expertiza GitHub can be found [ here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to our repository can be found [https://github.com/njdowdle/expertiza/tree/beta here] &amp;lt;br/&amp;gt;&lt;br /&gt;
Our implementation video can be found here &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous Wiki can be found [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2020_-_E2075._calibration_submissions_should_be_copied_along_with_calibration_assignments#Project_Overview here] &amp;lt;br/&amp;gt;&lt;br /&gt;
The previous implementation video can be found [https://youtu.be/cyhy2mVXcPM &lt;br /&gt;
 here] &amp;lt;br/&amp;gt;&lt;br /&gt;
A link to the previous GitHub Repo can be found [https://github.com/expertiza/expertiza/pull/1856 here] &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144024</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144024"/>
		<updated>2022-04-04T23:36:51Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Team Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144023</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144023"/>
		<updated>2022-04-04T23:36:35Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
&lt;br /&gt;
== '''Final Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144022</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144022"/>
		<updated>2022-04-04T23:35:36Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Files Requiring Modification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
More detail&lt;br /&gt;
==='''Pictures?'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144021</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144021"/>
		<updated>2022-04-04T23:34:41Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
Add description&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
Detail notes from meeting with mentor&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144020</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144020"/>
		<updated>2022-04-04T23:34:09Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
Add description&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144019</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144019"/>
		<updated>2022-04-04T23:33:53Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
Add description for E2234&lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144018</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144018"/>
		<updated>2022-04-04T23:33:20Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
E2234 &lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our Repository Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Our New Video Link &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Wiki &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous Video &amp;lt;br/&amp;gt;&lt;br /&gt;
Add Previous GitHub Repo Link &amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144017</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144017"/>
		<updated>2022-04-04T23:31:16Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
E2234 &lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Conclusion ''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link&lt;br /&gt;
Add Our Repository Link&lt;br /&gt;
Add Our New Video Link&lt;br /&gt;
Add Previous Wiki&lt;br /&gt;
Add Previous Video&lt;br /&gt;
Add Previous GitHub Repo Link&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144016</id>
		<title>CSC/ECE 517 Spring 2022 - E2234. 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_Spring_2022_-_E2234._Calibration_submissions_should_be_copied_along_with_calibration_assignments&amp;diff=144016"/>
		<updated>2022-04-04T23:26:24Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: Created page with &amp;quot;== '''Introduction''' == E2234   == '''Problem Statement''' ==  == '''Previous Implementation''' ==  === '''What needs to be done''' ===  == '''Design''' ==  ==='''Files Requi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Introduction''' ==&lt;br /&gt;
E2234 &lt;br /&gt;
&lt;br /&gt;
== '''Problem Statement''' ==&lt;br /&gt;
&lt;br /&gt;
== '''Previous Implementation''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''What needs to be done''' ===&lt;br /&gt;
&lt;br /&gt;
== '''Design''' ==&lt;br /&gt;
&lt;br /&gt;
==='''Files Requiring Modification'''===&lt;br /&gt;
&lt;br /&gt;
== '''Test Plan''' ==&lt;br /&gt;
&lt;br /&gt;
=== '''UI Testing''' ===&lt;br /&gt;
&lt;br /&gt;
=== '''Automated Testing''' ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Team Information''' ==&lt;br /&gt;
&lt;br /&gt;
Mentor: Dr. Ed Gehringer (efg@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Nolan Dowdle (njdowdle@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Laura Fox (lmcampb5@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Soeun Jo (sjo@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Harshil Shah (hshah6@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== '''Resources''' ==&lt;br /&gt;
Add Expertiza GitHub Link&lt;br /&gt;
Add Our Repository Link&lt;br /&gt;
Add Our New Video Link&lt;br /&gt;
Add Previous Wiki&lt;br /&gt;
Add Previous Video&lt;br /&gt;
Add Previous GitHub Repo Link&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022&amp;diff=144014</id>
		<title>CSC/ECE 517 Spring 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022&amp;diff=144014"/>
		<updated>2022-04-04T23:15:03Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Final Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== OSS Projects ==&lt;br /&gt;
&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2200: Testing advice_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2203: Adding tests for courses_controller, eula_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2204: Adding tests for markup_styles_controller, lock_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2208: Testing for submission_records_controller, profile_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2218: Refactor response_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2217: Refactor questionnaires_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2216: Refactor late_policies_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2215: Refactor student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2214: Refactor teams_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2219: Improve assessment360_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2211: Testing for summary_helper]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2225: Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2221: Refactor submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2206: Testing for users_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2207: Testing for submitted_content_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2205: Testing for participants_controller, versions_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2212: Testing for hamer.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - S2200: Refactoring evaluation of SQL queries (Java/JUnit)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - S2222: Refactor impersonate_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2202- Testing for badges_controller, publishing_controller]]&lt;br /&gt;
*[[CSC/ECE 517 Spring 2022 - E2220: Refactor reputation_web_service_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2224: Refactor review_mapping_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2209: Testing for analytic helper.rb, join team requests helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2227: SQL Injection Fix]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2223. Refactor sign up sheet controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2201: Testing for assignment_questionnaire_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2243. Refactor student_teams functionality]]&lt;br /&gt;
&lt;br /&gt;
== Final Projects ==&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2245: View for results of bidding]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2241: Heatgrid fixes and improvements]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2237: Grading audit trail]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - S2201: Improving User Experience for SQLFE]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2236: Fix issues related to deadlines and late policies]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2233. Improving search facility in Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2234. Calibration submissions should be copied along with calibration assignments]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2244. Support for saying your team pair-programmed]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2246: Email your authors/reviewers, with complete tests]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2228: Refactor JavaScript]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2239: Further refactoring and improvement of review mapping helper.rb ]]&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143941</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143941"/>
		<updated>2022-04-04T01:52:48Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* view */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously had 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do implicity get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller testing can be found [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
*folder_action&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
The function tests whether a user is allowed to perform edit actions, as dictated by the current_user_id matching the @participant.user_id and ensuring they have the proper edit rights. When successful, the call should render the &amp;quot;:edit&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
The function first verifies if the user has rights to view the current contents by validating with current_user_id matching the @participant.user_id. If this is valid, then you are redirected to the edit action, except in the 'view: true' format.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that it flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We finished with 27 implemented tests in 9 contexts, and 9 pending tests that could be implemented in the future.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage.  The coveralls bot on GitHub reported 51% on our 2nd pull request.  We believe this number may be lower because private methods in the controller weren't explicitly tested.  &lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
The controller could use refactoring.  Specifically, it appears the remove_hyperlink method is not currently used.  It should be used if verified to work or removed.&lt;br /&gt;
&lt;br /&gt;
Testing of the folder_action method should be done, but we were unable to get it working with the file fixtures approach.  &lt;br /&gt;
&lt;br /&gt;
Two pull requests were created for Expertiza (see related links).  Our first pull request was accepted and merged into the beta branch.  Our 2nd pull request is pending review.  We are not aware of any automated build errors and the expertiza-travisci-bot commented that the changes look good on our latest pull request.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143940</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143940"/>
		<updated>2022-04-04T01:52:30Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* edit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously had 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do implicity get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller testing can be found [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
*folder_action&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
The function tests whether a user is allowed to perform edit actions, as dictated by the current_user_id matching the @participant.user_id and ensuring they have the proper edit rights. When successful, the call should render the &amp;quot;:edit&amp;quot; template.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that it flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We finished with 27 implemented tests in 9 contexts, and 9 pending tests that could be implemented in the future.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage.  The coveralls bot on GitHub reported 51% on our 2nd pull request.  We believe this number may be lower because private methods in the controller weren't explicitly tested.  &lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
The controller could use refactoring.  Specifically, it appears the remove_hyperlink method is not currently used.  It should be used if verified to work or removed.&lt;br /&gt;
&lt;br /&gt;
Testing of the folder_action method should be done, but we were unable to get it working with the file fixtures approach.  &lt;br /&gt;
&lt;br /&gt;
Two pull requests were created for Expertiza (see related links).  Our first pull request was accepted and merged into the beta branch.  Our 2nd pull request is pending review.  We are not aware of any automated build errors and the expertiza-travisci-bot commented that the changes look good on our latest pull request.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143938</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143938"/>
		<updated>2022-04-03T21:45:53Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously had 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do implicity get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller testing can be found [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
*folder_action&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that it flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
We finished with 27 implemented tests in 9 contexts, and 9 pending tests that could be implemented in the future.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage.  The coveralls bot on GitHub reported 51% on our 2nd pull request.  We believe this number may be lower because private methods in the controller weren't explicitly tested.  &lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
The controller could use refactoring.  Specifically, it appears the remove_hyperlink method is not currently used.  It should be used if verified to work or removed.&lt;br /&gt;
&lt;br /&gt;
Testing of the folder_action method should be done, but we were unable to get it working with the file fixtures approach.  &lt;br /&gt;
&lt;br /&gt;
Two pull requests were created for Expertiza (see related links).  Our first pull request was accepted and merged into the beta branch.  Our 2nd pull request is pending review.  We are not aware of any automated build errors and the expertiza-travisci-bot commented that the changes look good on our latest pull request.&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143937</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143937"/>
		<updated>2022-04-03T21:23:59Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* submit hyperlink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously had 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do implicity get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller testing can be found [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
*folder_action&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that it flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Add description. Include test coverage info, any automatic build errors, how we could enhance testing, how many contexts were used, etc. Talk about need for refactoring of the controller.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage&lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143936</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143936"/>
		<updated>2022-04-03T21:22:33Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Submitted Content Controller Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously had 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do implicity get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller testing can be found [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
*folder_action&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that is flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Add description. Include test coverage info, any automatic build errors, how we could enhance testing, how many contexts were used, etc. Talk about need for refactoring of the controller.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage&lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143935</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143935"/>
		<updated>2022-04-03T21:21:30Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously had 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do implicity get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller can be found below [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that is flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Add description. Include test coverage info, any automatic build errors, how we could enhance testing, how many contexts were used, etc. Talk about need for refactoring of the controller.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage&lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143934</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143934"/>
		<updated>2022-04-03T21:19:03Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Related Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously has 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do inevitably get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller can be found below [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that is flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Add description. Include test coverage info, any automatic build errors, how we could enhance testing, how many contexts were used, etc. Talk about need for refactoring of the controller.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage&lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A 2nd pull request made, after the first pull request was accepted can be found [https://github.com/expertiza/expertiza/pull/2363/ here]&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [https://youtu.be/V4Yo3vp9qME here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143933</id>
		<title>CSC/ECE 517 Spring 2022 - E2207: Testing for submitted content controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2207:_Testing_for_submitted_content_controller.rb&amp;diff=143933"/>
		<updated>2022-04-03T20:54:23Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== About Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is the software benefits for both instructors and students by supporting various types of submissions and providing reusable objects for peer review. It is an open-source project based on [http://rubyonrails.org/ Ruby on Rails] framework. It allows the instructors not only to create and customize new or existing assignments but also to create a list of topics the students can sign up for. Students can form teams to work on various projects and assignments. Expertiza also lets students peer-review other students' submissions, enabling them to work together to improve others' learning experiences.&lt;br /&gt;
&lt;br /&gt;
== Current Project Description ==&lt;br /&gt;
&lt;br /&gt;
This Expertiza OSS project &amp;quot;E2207: Testing for submitted_content_controller&amp;quot; is focused on adding unit tests for submitted_content_controller.rb.&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
&lt;br /&gt;
* submitted_content_controller.rb&lt;br /&gt;
* submitted_content_controller_spec.rb&lt;br /&gt;
* test files (helloworld.c and the-rspec-book_p2_1.pdf) located [https://github.com/LFox95/expertiza/tree/beta/spec/fixtures/files here]&lt;br /&gt;
&lt;br /&gt;
The test files are used to test functionality in the submit_file method.&lt;br /&gt;
&lt;br /&gt;
=== Running Tests ===&lt;br /&gt;
Ensure the test files are located in /expertizabeta/spec/fixtures/files&lt;br /&gt;
&lt;br /&gt;
  rspec ./spec/controllers/submitted_content_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
The submitted_content_controller previously has 1 public method (submit_file) tested which was very minimal. Additionally, the controller has 8 public methods that had no previous testing, and 9 private methods.  &lt;br /&gt;
&lt;br /&gt;
This test plan only covers testing for the public methods.  RSpec is a Behavior Driven Design (BDD) focused test language where code interface and behavior is tested, not implementation. Additionally in Sandi Metz's talk on The Magic Tricks of Testing, she warns against testing private methods as testing them binds you to the current implementation of the code. Most private methods do inevitably get tested while testing the public methods.&lt;br /&gt;
&lt;br /&gt;
The RSpec unit tests added for these methods in the spec file 'submitted_content_controller_spec.rb' are discussed below.&lt;br /&gt;
&lt;br /&gt;
===Submitted Content Controller Methods===&lt;br /&gt;
The code of the controller can be found below [https://github.com/LFox95/expertiza/blob/beta/spec/controllers/submitted_content_controller_spec.rb here]&lt;br /&gt;
&lt;br /&gt;
The public methods which are not tested are:&lt;br /&gt;
*remove_hyperlink&lt;br /&gt;
&lt;br /&gt;
The private methods which are tested in a public method are:&lt;br /&gt;
*check_content_type_integrity - tested in submit_file public method&lt;br /&gt;
*check_file_size - tested in submit_file public method&lt;br /&gt;
&lt;br /&gt;
The private methods which are not explicitly tested are:&lt;br /&gt;
*file_type&lt;br /&gt;
*move_selected_file&lt;br /&gt;
*rename_selected_file&lt;br /&gt;
*delete_selected_file&lt;br /&gt;
*copy_selected_file&lt;br /&gt;
*create_new_folder&lt;br /&gt;
*one_team_can_submit_work?&lt;br /&gt;
&lt;br /&gt;
===Test Code===&lt;br /&gt;
&lt;br /&gt;
==== action_allowed? ====&lt;br /&gt;
The action_allowed? method checks that the current user is a student with required authorizations for the edit, submit_file, and submit_hyperlink methods.  The test approach was borrowed from E2205 and expanded on.  It tests the return value of action_allowed? in 7 scenarios&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#action_allowed?' do&lt;br /&gt;
  context 'current user is not authorized' do&lt;br /&gt;
    it 'does not allow action for no user' do&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
    it 'does not allow action for student without authorizations' do&lt;br /&gt;
      allow(controller).to receive(:current_user).and_return(build(:student))&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be false&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user has needed privileges' do&lt;br /&gt;
    it 'allows edit action for student with needed authorizations' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:are_needed_authorizations_present?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'edit'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit file action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_file'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows submit hyperlink action for students with team that can submit' do&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(controller).to receive(:one_team_can_submit_work?).and_return(true)&lt;br /&gt;
      controller.params = {action: 'submit_hyperlink'}&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for admin' do&lt;br /&gt;
      stub_current_user(admin, admin.role.name, admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
    it 'allows action for super admin' do&lt;br /&gt;
      stub_current_user(super_admin, super_admin.role.name, super_admin.role)&lt;br /&gt;
      expect(controller.send(:action_allowed?)).to be true&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== controller_locale ====&lt;br /&gt;
We verify the controller_locale method returns the expected locale_for_student: I18n.default_locale&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#controller_locale' do&lt;br /&gt;
  it 'should return I18n.default_locale' do&lt;br /&gt;
    user = student1&lt;br /&gt;
    stub_current_user(user, user.role.name, user.role)&lt;br /&gt;
    expect(controller.send(:controller_locale)).to eq(I18n.default_locale)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== edit ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#edit' do&lt;br /&gt;
  it 'student#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#edit' do&lt;br /&gt;
  it 'instructor#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#edit' do&lt;br /&gt;
  it 'superadmin#edit it' do&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    allow(Participant).to receive(:find_by).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :edit, params: params&lt;br /&gt;
    expect(response).to render_template(:edit)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== view ====&lt;br /&gt;
Add Description&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe 'student#view' do&lt;br /&gt;
  it 'student#view it' do&lt;br /&gt;
    #puts('-----STUDENT#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'instructor#view' do&lt;br /&gt;
  it 'instructor#view it' do&lt;br /&gt;
    #puts('-----instructor#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    #puts('-------inst a-----------')&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    #puts('-------inst b-----------')&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
describe 'superadmin#view' do&lt;br /&gt;
  it 'superadmin#view it' do&lt;br /&gt;
    #puts('-----superadmin#view--------')&lt;br /&gt;
    allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
    stub_current_user(superadmin1, superadmin1.role.name, superadmin1.role)&lt;br /&gt;
    allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    params = { id: 21 }&lt;br /&gt;
    response = get :view, params: params&lt;br /&gt;
    expect(response).to redirect_to(action: :edit, view: true, id: 21)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit hyperlink ====&lt;br /&gt;
We test the submit_hyperlink error checking by verifying that is flashes an error for duplicate hyperlinks and invalid URLs&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_hyperlink' do&lt;br /&gt;
  context 'current user is participant and submits hyperlink' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      allow(participant).to receive(:name).and_return('Name')&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if a duplicate hyperlink is submitted' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
      params = {submission: &amp;quot;google.com&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'You or your teammate(s) have already submitted the same hyperlink.'&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if url is invalid' do&lt;br /&gt;
      allow(team).to receive(:hyperlinks).and_return([])&lt;br /&gt;
      params = {submission: &amp;quot;abc123&amp;quot;, id: 21}&lt;br /&gt;
      response = get :submit_hyperlink, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses #{$ERROR_INFO}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== remove hyperlink ====&lt;br /&gt;
We created 2 pending tests for this method, it doesn't appear to currently be used in the submitted_content_controller and may need work.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#remove_hyperlink' do&lt;br /&gt;
  #NOTE - this method is not currently used, the below context is a start&lt;br /&gt;
  #       at proposed tests that may be useful in the future&lt;br /&gt;
  context 'current user is participant' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
      #allow(participant).to receive(:team).and_return(team)&lt;br /&gt;
      #allow(team).to receive(:hyperlinks).and_return(['google.com'])&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit if submissions are allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'redirects to view if submissions are not allowed' #do&lt;br /&gt;
      #params = {id: 1}&lt;br /&gt;
      #allow(assignment).to receive(:submission_allowed).and_return(true)&lt;br /&gt;
      #response = get :remove_hyperlink, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :view, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== submit_file ====&lt;br /&gt;
Submit_file had one test prior to this project, however this test appears to have broken after the Expertiza Rails 5.1 migration.  We added tests for error checking, verifying that an error is flashed if a file exceeding the size limit or a file with an unaccepted type is submitted.  We did this using file fixtures and added two new files for test to \spec\fixtures\files.  We chose to use file fixtures to keep these tests fast (F.I.R.S.T) as opposed to creating test files on the fly&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#submit_file' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    # this test has problems after rails 5.1 migration, getting 'undefined method 'size' for nil:NilClass' error&lt;br /&gt;
    # when 'check_content_size' method is called in submitted_content_controller, doesn't seem to be a problem in&lt;br /&gt;
    # other submit_file tests that should call the same method though...&lt;br /&gt;
    it 'renders edit template' #do&lt;br /&gt;
      #allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      #stub_current_user(instructor1, instructor1.role.name, instructor1.role)&lt;br /&gt;
      #request_params = { id: 1 }&lt;br /&gt;
      #response = get :submit_file, params: request_params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
  end&lt;br /&gt;
  context 'user that is participant uploads a file' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file exceeding size limit' do&lt;br /&gt;
      allow(controller).to receive(:check_content_size).and_return(false)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/the-rspec-book_p2_1.pdf&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses variable size limit&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for file of unexpected type' do&lt;br /&gt;
      allow(SubmittedContentController).to receive(:check_content_type_integrity).and_return(false)&lt;br /&gt;
      allow(MimeMagic).to receive(:by_magic).and_return(&amp;quot;not valid&amp;quot;)&lt;br /&gt;
      allow_any_instance_of(Rack::Test::UploadedFile::String).to receive(:read).and_return(&amp;quot;&amp;quot;)&lt;br /&gt;
      file = Rack::Test::UploadedFile.new(&amp;quot;#{Rails.root}/spec/fixtures/files/helloworld.c&amp;quot;)&lt;br /&gt;
      params = {uploaded_file: file,&lt;br /&gt;
                  id: 1}&lt;br /&gt;
      response = get :submit_file, params: params&lt;br /&gt;
      expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
      expect(flash[:error]).to eq 'File type error'&lt;br /&gt;
    end&lt;br /&gt;
    # we could test that file is written and submission record is created, but we could have to&lt;br /&gt;
    # make assumptions about how path is formed and user input for path/filename is sanitized.  We don't want&lt;br /&gt;
    # this test coupled to the existing implementation&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== folder_action ====&lt;br /&gt;
We've added 6 pending tests for folder_action.  The folder_action method actually manipulates files on the server so testing these methods may require some creativity.  Using file fixtures (similar to testing done for submit_file method) may be a way to implement the pending tests.&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#folder_action' do&lt;br /&gt;
  context 'current user does not match up with the participant' do&lt;br /&gt;
    #method just returns in this context, how do we test that?&lt;br /&gt;
  end&lt;br /&gt;
  context 'current user is participant performing folder action' do&lt;br /&gt;
    before(:each) do&lt;br /&gt;
      allow(AssignmentParticipant).to receive(:find).and_return(participant)&lt;br /&gt;
      stub_current_user(student1, student1.role.name, student1.role)&lt;br /&gt;
    end&lt;br /&gt;
    it 'redirects to edit' #do&lt;br /&gt;
      #params = {id: 1, faction: nil}&lt;br /&gt;
      #response = get :folder_action, params&lt;br /&gt;
      #expect(response).to redirect_to(action: :edit, id: 1)&lt;br /&gt;
    #end&lt;br /&gt;
    it 'delete action deletes selected files'&lt;br /&gt;
    it 'rename action renames selected file'&lt;br /&gt;
    it 'move action moves selected file'&lt;br /&gt;
    it 'copy action copies selected file'&lt;br /&gt;
    it 'create folder action creates new directory'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== download ====&lt;br /&gt;
We created 5 tests (one of them pending) to verify that the download method flashes errors for invalid path names and non-existant files&lt;br /&gt;
&lt;br /&gt;
Code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
describe '#download' do&lt;br /&gt;
  context 'user downloads file' do&lt;br /&gt;
    it 'flashes error for nil folder name' do&lt;br /&gt;
      params = {folder_name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error for nil file name' do&lt;br /&gt;
      params = {name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if attempt is to download entire folder' do&lt;br /&gt;
      params = {folder_name: 'test_directory', name: nil}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present # not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'flashes error if file does not exist' do&lt;br /&gt;
      params = {folder_name: 'unlikely_dir_name', name: 'nonexistantfile.no'}&lt;br /&gt;
      response = get :download, params: params&lt;br /&gt;
      expect(flash[:error]).to be_present #not checking message content since it uses exception message&lt;br /&gt;
    end&lt;br /&gt;
    it 'calls send for a valid file download' do&lt;br /&gt;
      # still figuring this one out...&lt;br /&gt;
      #params = {folder_name: 'test_dir', name: 'test.txt'}&lt;br /&gt;
      #File.stub(:exist?).and_return(true)&lt;br /&gt;
      #response = get :download, params&lt;br /&gt;
      #expect(download).to receive(:send_file)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
Add description. Include test coverage info, any automatic build errors, how we could enhance testing, how many contexts were used, etc. Talk about need for refactoring of the controller.&lt;br /&gt;
&lt;br /&gt;
Coverall coverage report (expertiza/coverage/index.html) reported 44.32% coverage&lt;br /&gt;
[[File:E2207_Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
&lt;br /&gt;
The main repository can be found [https://github.com/expertiza/expertiza/tree/beta here].&lt;br /&gt;
&lt;br /&gt;
The forked git repository for this project can be found [https://github.com/LFox95/expertiza here].&lt;br /&gt;
&lt;br /&gt;
The pull request can be found [https://github.com/expertiza/expertiza/pull/2349 here].&lt;br /&gt;
&lt;br /&gt;
A video of all tests running can be seen [here].&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2207_Coverage.png&amp;diff=143932</id>
		<title>File:E2207 Coverage.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2207_Coverage.png&amp;diff=143932"/>
		<updated>2022-04-03T20:53:38Z</updated>

		<summary type="html">&lt;p&gt;Lmcampb5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lmcampb5</name></author>
	</entry>
</feed>