<?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=Kflemin3</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=Kflemin3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Kflemin3"/>
	<updated>2026-06-03T04:37:48Z</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_-_E2237:_Grading_audit_trail&amp;diff=145429</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=145429"/>
		<updated>2022-04-26T03:53:43Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Implementation */ change size of screenshot&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Topic Overview &amp;amp; Prior Work (E2158) ==&lt;br /&gt;
=== Feature Overview ===&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2158._Grading_audit_trail E2158] contains detailed information on the previous team's work with this feature. &lt;br /&gt;
&lt;br /&gt;
'''A summary of the desired functionality is presented below:'''&lt;br /&gt;
&lt;br /&gt;
Any instructor can assign or edit a grade freely. &lt;br /&gt;
&lt;br /&gt;
There should be a way to track which instructor assigned or edited a grade, along with any comments they wrote justifying that grade.&lt;br /&gt;
&lt;br /&gt;
These things must be recorded in the grading audit trail any time an instructor assigns or edits a grade and its comments:&lt;br /&gt;
* id of the instructor&lt;br /&gt;
* timestamp&lt;br /&gt;
Additionally, any comments written by other instructors should be preserved.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes By Previous Team ===&lt;br /&gt;
&lt;br /&gt;
*A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
**Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
*Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
*A view for displaying the grading history of a particular assignment or review was added ('''grading_histories/index.html.erb''').&lt;br /&gt;
&lt;br /&gt;
=== Files Modified By Previous Team ===&lt;br /&gt;
* \app\controllers\grades_controller.rb&lt;br /&gt;
* \app\controllers\grading_histories_controller.rb&lt;br /&gt;
* \app\controllers\review_mapping_controller.rb&lt;br /&gt;
* \app\helpers\grading_histories_helper.rb&lt;br /&gt;
* \app\models\grading_history.rb&lt;br /&gt;
* \app\models\review_grading_history.rb&lt;br /&gt;
* \app\models\submission_grading_history.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
* \app\views\grading_histories\index.html.erb&lt;br /&gt;
* \app\views\reports\_review_report.html.erb&lt;br /&gt;
* \config\routes.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Testing By Previous Team ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' were added.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
functional tests added to these files&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/models/grading_history.rb&lt;br /&gt;
: spec/controllers/grading_history_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A ''feature test'' ensuring that a submission's grading history is shown completely, and in chronological order, was added.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Issues with Existing Tests ====&lt;br /&gt;
Only review_mapping_controller_spec.rb runs successfully--'''every other spec file mentioned above crashes'''.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
''There are '''three areas of focus''' for our team's project (E2237):''&lt;br /&gt;
=== System Crashes and Object Creation ===&lt;br /&gt;
&lt;br /&gt;
# We must ensure that the unit tests no longer crash, and that they pass with appropriate coverage.&lt;br /&gt;
# We must ensure that the creation of testing objects, namely, Assignments, and Project Bids, does not cause crashing.&lt;br /&gt;
&lt;br /&gt;
=== Changes to Grading History View ===&lt;br /&gt;
&lt;br /&gt;
The grading history table in the view is earmarked for certain changes:&lt;br /&gt;
# '''Student ID''' is a redundant field--move it to the page header.&lt;br /&gt;
# '''Assignment ID''' is a redundant field--move it to the page header.&lt;br /&gt;
&lt;br /&gt;
=== Code and Documentation Goals ===&lt;br /&gt;
&lt;br /&gt;
We must explain changes made to files with diagrams and justifications.&lt;br /&gt;
&lt;br /&gt;
Explanations will be provided from these perspectives:&lt;br /&gt;
* data flow&lt;br /&gt;
* functions&lt;br /&gt;
* code comments&lt;br /&gt;
&lt;br /&gt;
==Data Flow and Functionality==&lt;br /&gt;
===Old Data Flow===&lt;br /&gt;
The existing ''data flow'' for the grading history feature for reviews is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;position:relative;left:0px;top:0px&amp;quot;&amp;gt;[[File:Reviewhistory.jpg|270px]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;position:relative;left:125px;top:0px&amp;quot;&amp;gt;[[File:Review scores imported.png|560px]] &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The related ''table'' from the database is [https://expertiza.csc.ncsu.edu/index.php/Review_scores review_scores].&lt;br /&gt;
&lt;br /&gt;
===New Data Flow===&lt;br /&gt;
&lt;br /&gt;
The latest ''flow'' for the Grading History functionality is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:kai_diagram1.jpg|345px]]&lt;br /&gt;
&lt;br /&gt;
The primary function of this change is to DRY out the current implementation. The flow shown below tracks the tables where grades and comments(that comprise grading history) are recorded into already existing tables.  The newly created table '''grading_history''' is linked to the '''teams''' table from which comments and grades are drawn. This table then displays these values, thereby completing the functionality when the user clicks on display history. The '''grading_history''' table contains the team id and instructor_name &lt;br /&gt;
&lt;br /&gt;
[[File:Kai_new_flow 3.jpg|650px]]&lt;br /&gt;
&lt;br /&gt;
== Planned and Completed Work ==&lt;br /&gt;
&lt;br /&gt;
=== General Design Goals ===&lt;br /&gt;
====Changes to the Grading History Table====&lt;br /&gt;
&lt;br /&gt;
The images below reference grading history view issues mentioned above in the ''Problem Statement''.&lt;br /&gt;
&lt;br /&gt;
To DRY the code, we will remove the redundant table data boxed below...&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; ...and we'll move it to the page header:&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_2.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Behavior Driven Development'''&amp;lt;br&amp;gt;&lt;br /&gt;
Due to the nature of the functionalities that we will be implementing, we will be following a BDD methodology - Our primary intention with this is to focus our refactoring, development and database design efforts to ensure that end-user functionality is implemented fully.&amp;lt;br&amp;gt;&lt;br /&gt;
In order to demonstrate this, we have provided our tests ahead of time and will be using them to guide our development efforts. [[CSC/ECE 517 Spring 2022 - E2237: Grading audit trail#RSpec Unit Tests|BDD Scenarios]]&lt;br /&gt;
&lt;br /&gt;
====System Stability: Strategies====&lt;br /&gt;
''The source of crashing issues is currently unknown.'' To debug this, we will pursue the following:&lt;br /&gt;
* Refactor the specs and controllers&lt;br /&gt;
** Ensure DRY principle is followed&lt;br /&gt;
** Improve readability and maintainability&lt;br /&gt;
** Add code comments as needed &lt;br /&gt;
* Ensure testing objects do not cause crashes&lt;br /&gt;
&lt;br /&gt;
====Documentation====&lt;br /&gt;
# Changes to any files will be documented on this page; the programmatical reasoning behind the changes shall be explained, and will be in accordance with the DRY principle.&lt;br /&gt;
# Any changes to the overall program logic and data flow will be illustrated with UML diagrams in this document, along with the reasoning for any such changes.&lt;br /&gt;
# A pull request of the fixed code, fully commented, will be provided in this document.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
*/app/views/grading_histories/index.html.erb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% record = @grading_histories[0]&lt;br /&gt;
  if record == nil&lt;br /&gt;
    receiver = &amp;quot;&amp;quot;&lt;br /&gt;
    assignment = &amp;quot;&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    if record.grading_type == &amp;quot;Submission&amp;quot;&lt;br /&gt;
      receiver = &amp;quot;of &amp;quot; + Team.where(id: record.grade_receiver_id).pluck(:name).first&lt;br /&gt;
      assignment = &amp;quot;for the submission &amp;quot; + Assignment.where(id: record.assignment_id).pluck(:name).first&lt;br /&gt;
    else&lt;br /&gt;
      receiver = &amp;quot;of &amp;quot; + User.where(id: record.grade_receiver_id).pluck(:fullname).first&lt;br /&gt;
      assignment = &amp;quot;for review in &amp;quot; + Assignment.where(id: record.assignment_id).pluck(:name).first&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;center&amp;quot;&amp;gt;Grade History &amp;lt;%= receiver %&amp;gt; &amp;lt;%= assignment %&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;border-collapse:collapse; table-layout:fixed; width:1500px;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;thead&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Instructor&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Grade&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Comment&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Graded At&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;!--This is the main view of the table. This will add table with either hyperlink or the content nased on the operation. --&amp;gt;&lt;br /&gt;
  &amp;lt;tbody&amp;gt;&lt;br /&gt;
  &amp;lt;% @grading_histories.each do |record| %&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= User.where(id: record.instructor_id).pluck(:fullname).first %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= record.grade %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:60px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= record.comment %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= record.created_at %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Screenshot of the Grading History Table&lt;br /&gt;
&lt;br /&gt;
[[File:Submission_Grading_History_Table.jpeg|1000px]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/ItrCCEY1jR8 Live Demo: Functionality]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://youtu.be/9x59twFwwC0 RSpec Test Demo]&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
# Verify that Assignments can be created and are saved to the database.&lt;br /&gt;
# Ensure that Student ID is shown in the header, and verify via manual UI testing &lt;br /&gt;
# Ensure that Assignment ID is shown in the header, and verify via manual UI testing&lt;br /&gt;
# Finally, verify that tests can be run without crashing the system.&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
'''''Test cases provided here, will add RSpec code blocks for the final submission'''''&lt;br /&gt;
&lt;br /&gt;
*Factory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Used for Grading Histories Controller Spec&lt;br /&gt;
factory :grading_history, class: GradingHistory do&lt;br /&gt;
    id 1&lt;br /&gt;
    instructor_id 6&lt;br /&gt;
    assignment_id 1&lt;br /&gt;
    grading_type 'Submission'&lt;br /&gt;
    grade_receiver_id 1&lt;br /&gt;
    grade 100&lt;br /&gt;
    comment 'Good work!'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Assignments&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Assignment Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment with all the necessary fields&lt;br /&gt;
   Then: Assignment is saved in the database&lt;br /&gt;
&lt;br /&gt;
Scenario: Duplicate Assignment Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment with all the necessary fields&lt;br /&gt;
   Then: Assignment already exists message is shown&lt;br /&gt;
&lt;br /&gt;
Scenario: Assignment Creation without all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment without all the necessary fields&lt;br /&gt;
   Then: Message to input fields is shown&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Grading Histories&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Grading History creation&lt;br /&gt;
Given: A team exists for a particular assignment and has a submission&lt;br /&gt;
When: An instructor assigns a grade for that submission&lt;br /&gt;
Then: The grading history entry is created&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Review Mapping&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Save Reviewer Grade and Comment&lt;br /&gt;
Given: A student has given a review for a submission&lt;br /&gt;
When: An instructor assigns a grade for the review&lt;br /&gt;
Then: The assigned grade and the accompanying comment are saved&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Grade&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Save Grade and Comment for Submission&lt;br /&gt;
Given: A team has made a submission for an assignment&lt;br /&gt;
When: An instructor assigns a grade for the submission&lt;br /&gt;
Then: The assigned grade and the accompanying comment are saved&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Tests ===&lt;br /&gt;
''Note: Discussion with mentor in progress to determine if UI Automation testing is in scope ''&lt;br /&gt;
*Student ID in header&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Student ID in grading history view &lt;br /&gt;
Logged in as an Instructor/Admin&lt;br /&gt;
  On Assignment page, click on Grading History&lt;br /&gt;
   Resulting Grading History Table is shown&lt;br /&gt;
    Student ID appears in the header, not in any table columns&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Assignment ID in header&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Assignment ID in grading history view &lt;br /&gt;
Logged in as an Instructor/Admin&lt;br /&gt;
  On Assignment page, click on Grading History&lt;br /&gt;
   Resulting Grading History Table is shown&lt;br /&gt;
    Assignment ID appears in the header, not in any table columns&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regression Testing ===&lt;br /&gt;
''In order to ensure complete coverage, testing of the changes done between the end of last semester and this project will be done to ensure that ''&lt;br /&gt;
''old test cases still pass.''&lt;br /&gt;
&lt;br /&gt;
# Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
# Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
&lt;br /&gt;
== Conclusions and Future Work ==&lt;br /&gt;
=== Comprehensive Testing and Scope ===&lt;br /&gt;
* '''Initial Thoughts:''' Current code coverage cannot be determined due to a combination of missing tests and simulation crashes. This will need to be fixed to enable monitoring of regular metrics, and adding comprehensive tests that target full code coverage.&lt;br /&gt;
* ''will be added for final submission''&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
''will be added for final submission''&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2164 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Fall 2021 - E2158. Grading audit trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc E1934 implementation video walkthrough]&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/ItrCCEY1jR8 Live Demo: Functionality]&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/9x59twFwwC0 RSpec Test Demo]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2399 Pull Request]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=145426</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=145426"/>
		<updated>2022-04-26T03:52:44Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Topic Overview &amp;amp; Prior Work (E2158) ==&lt;br /&gt;
=== Feature Overview ===&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2158._Grading_audit_trail E2158] contains detailed information on the previous team's work with this feature. &lt;br /&gt;
&lt;br /&gt;
'''A summary of the desired functionality is presented below:'''&lt;br /&gt;
&lt;br /&gt;
Any instructor can assign or edit a grade freely. &lt;br /&gt;
&lt;br /&gt;
There should be a way to track which instructor assigned or edited a grade, along with any comments they wrote justifying that grade.&lt;br /&gt;
&lt;br /&gt;
These things must be recorded in the grading audit trail any time an instructor assigns or edits a grade and its comments:&lt;br /&gt;
* id of the instructor&lt;br /&gt;
* timestamp&lt;br /&gt;
Additionally, any comments written by other instructors should be preserved.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes By Previous Team ===&lt;br /&gt;
&lt;br /&gt;
*A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
**Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
*Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
*A view for displaying the grading history of a particular assignment or review was added ('''grading_histories/index.html.erb''').&lt;br /&gt;
&lt;br /&gt;
=== Files Modified By Previous Team ===&lt;br /&gt;
* \app\controllers\grades_controller.rb&lt;br /&gt;
* \app\controllers\grading_histories_controller.rb&lt;br /&gt;
* \app\controllers\review_mapping_controller.rb&lt;br /&gt;
* \app\helpers\grading_histories_helper.rb&lt;br /&gt;
* \app\models\grading_history.rb&lt;br /&gt;
* \app\models\review_grading_history.rb&lt;br /&gt;
* \app\models\submission_grading_history.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
* \app\views\grading_histories\index.html.erb&lt;br /&gt;
* \app\views\reports\_review_report.html.erb&lt;br /&gt;
* \config\routes.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Testing By Previous Team ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' were added.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
functional tests added to these files&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/models/grading_history.rb&lt;br /&gt;
: spec/controllers/grading_history_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A ''feature test'' ensuring that a submission's grading history is shown completely, and in chronological order, was added.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Issues with Existing Tests ====&lt;br /&gt;
Only review_mapping_controller_spec.rb runs successfully--'''every other spec file mentioned above crashes'''.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
''There are '''three areas of focus''' for our team's project (E2237):''&lt;br /&gt;
=== System Crashes and Object Creation ===&lt;br /&gt;
&lt;br /&gt;
# We must ensure that the unit tests no longer crash, and that they pass with appropriate coverage.&lt;br /&gt;
# We must ensure that the creation of testing objects, namely, Assignments, and Project Bids, does not cause crashing.&lt;br /&gt;
&lt;br /&gt;
=== Changes to Grading History View ===&lt;br /&gt;
&lt;br /&gt;
The grading history table in the view is earmarked for certain changes:&lt;br /&gt;
# '''Student ID''' is a redundant field--move it to the page header.&lt;br /&gt;
# '''Assignment ID''' is a redundant field--move it to the page header.&lt;br /&gt;
&lt;br /&gt;
=== Code and Documentation Goals ===&lt;br /&gt;
&lt;br /&gt;
We must explain changes made to files with diagrams and justifications.&lt;br /&gt;
&lt;br /&gt;
Explanations will be provided from these perspectives:&lt;br /&gt;
* data flow&lt;br /&gt;
* functions&lt;br /&gt;
* code comments&lt;br /&gt;
&lt;br /&gt;
==Data Flow and Functionality==&lt;br /&gt;
===Old Data Flow===&lt;br /&gt;
The existing ''data flow'' for the grading history feature for reviews is shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;position:relative;left:0px;top:0px&amp;quot;&amp;gt;[[File:Reviewhistory.jpg|270px]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;position:relative;left:125px;top:0px&amp;quot;&amp;gt;[[File:Review scores imported.png|560px]] &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The related ''table'' from the database is [https://expertiza.csc.ncsu.edu/index.php/Review_scores review_scores].&lt;br /&gt;
&lt;br /&gt;
===New Data Flow===&lt;br /&gt;
&lt;br /&gt;
The latest ''flow'' for the Grading History functionality is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:kai_diagram1.jpg|345px]]&lt;br /&gt;
&lt;br /&gt;
The primary function of this change is to DRY out the current implementation. The flow shown below tracks the tables where grades and comments(that comprise grading history) are recorded into already existing tables.  The newly created table '''grading_history''' is linked to the '''teams''' table from which comments and grades are drawn. This table then displays these values, thereby completing the functionality when the user clicks on display history. The '''grading_history''' table contains the team id and instructor_name &lt;br /&gt;
&lt;br /&gt;
[[File:Kai_new_flow 3.jpg|650px]]&lt;br /&gt;
&lt;br /&gt;
== Planned and Completed Work ==&lt;br /&gt;
&lt;br /&gt;
=== General Design Goals ===&lt;br /&gt;
====Changes to the Grading History Table====&lt;br /&gt;
&lt;br /&gt;
The images below reference grading history view issues mentioned above in the ''Problem Statement''.&lt;br /&gt;
&lt;br /&gt;
To DRY the code, we will remove the redundant table data boxed below...&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; ...and we'll move it to the page header:&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_2.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Behavior Driven Development'''&amp;lt;br&amp;gt;&lt;br /&gt;
Due to the nature of the functionalities that we will be implementing, we will be following a BDD methodology - Our primary intention with this is to focus our refactoring, development and database design efforts to ensure that end-user functionality is implemented fully.&amp;lt;br&amp;gt;&lt;br /&gt;
In order to demonstrate this, we have provided our tests ahead of time and will be using them to guide our development efforts. [[CSC/ECE 517 Spring 2022 - E2237: Grading audit trail#RSpec Unit Tests|BDD Scenarios]]&lt;br /&gt;
&lt;br /&gt;
====System Stability: Strategies====&lt;br /&gt;
''The source of crashing issues is currently unknown.'' To debug this, we will pursue the following:&lt;br /&gt;
* Refactor the specs and controllers&lt;br /&gt;
** Ensure DRY principle is followed&lt;br /&gt;
** Improve readability and maintainability&lt;br /&gt;
** Add code comments as needed &lt;br /&gt;
* Ensure testing objects do not cause crashes&lt;br /&gt;
&lt;br /&gt;
====Documentation====&lt;br /&gt;
# Changes to any files will be documented on this page; the programmatical reasoning behind the changes shall be explained, and will be in accordance with the DRY principle.&lt;br /&gt;
# Any changes to the overall program logic and data flow will be illustrated with UML diagrams in this document, along with the reasoning for any such changes.&lt;br /&gt;
# A pull request of the fixed code, fully commented, will be provided in this document.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
*/app/views/grading_histories/index.html.erb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% record = @grading_histories[0]&lt;br /&gt;
  if record == nil&lt;br /&gt;
    receiver = &amp;quot;&amp;quot;&lt;br /&gt;
    assignment = &amp;quot;&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    if record.grading_type == &amp;quot;Submission&amp;quot;&lt;br /&gt;
      receiver = &amp;quot;of &amp;quot; + Team.where(id: record.grade_receiver_id).pluck(:name).first&lt;br /&gt;
      assignment = &amp;quot;for the submission &amp;quot; + Assignment.where(id: record.assignment_id).pluck(:name).first&lt;br /&gt;
    else&lt;br /&gt;
      receiver = &amp;quot;of &amp;quot; + User.where(id: record.grade_receiver_id).pluck(:fullname).first&lt;br /&gt;
      assignment = &amp;quot;for review in &amp;quot; + Assignment.where(id: record.assignment_id).pluck(:name).first&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
  end&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;h1 class=&amp;quot;center&amp;quot;&amp;gt;Grade History &amp;lt;%= receiver %&amp;gt; &amp;lt;%= assignment %&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table style=&amp;quot;border-collapse:collapse; table-layout:fixed; width:1500px;&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;thead&amp;gt;&lt;br /&gt;
  &amp;lt;tr&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Instructor&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Grade&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Comment&amp;lt;/th&amp;gt;&lt;br /&gt;
    &amp;lt;th style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;Graded At&amp;lt;/th&amp;gt;&lt;br /&gt;
  &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;!--This is the main view of the table. This will add table with either hyperlink or the content nased on the operation. --&amp;gt;&lt;br /&gt;
  &amp;lt;tbody&amp;gt;&lt;br /&gt;
  &amp;lt;% @grading_histories.each do |record| %&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= User.where(id: record.instructor_id).pluck(:fullname).first %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= record.grade %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:60px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= record.comment %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td style=&amp;quot;padding:10px; border:solid 1.5px black; width:50px; word-wrap:break-word;&amp;quot;&amp;gt;&amp;lt;%= record.created_at %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;% end %&amp;gt;&lt;br /&gt;
  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Screenshot of the Grading History Table&lt;br /&gt;
&lt;br /&gt;
[[File:Submission_Grading_History_Table.jpeg]]&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/ItrCCEY1jR8 Live Demo: Functionality]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://youtu.be/9x59twFwwC0 RSpec Test Demo]&lt;br /&gt;
&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
# Verify that Assignments can be created and are saved to the database.&lt;br /&gt;
# Ensure that Student ID is shown in the header, and verify via manual UI testing &lt;br /&gt;
# Ensure that Assignment ID is shown in the header, and verify via manual UI testing&lt;br /&gt;
# Finally, verify that tests can be run without crashing the system.&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
'''''Test cases provided here, will add RSpec code blocks for the final submission'''''&lt;br /&gt;
&lt;br /&gt;
*Factory&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Used for Grading Histories Controller Spec&lt;br /&gt;
factory :grading_history, class: GradingHistory do&lt;br /&gt;
    id 1&lt;br /&gt;
    instructor_id 6&lt;br /&gt;
    assignment_id 1&lt;br /&gt;
    grading_type 'Submission'&lt;br /&gt;
    grade_receiver_id 1&lt;br /&gt;
    grade 100&lt;br /&gt;
    comment 'Good work!'&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Assignments&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Assignment Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment with all the necessary fields&lt;br /&gt;
   Then: Assignment is saved in the database&lt;br /&gt;
&lt;br /&gt;
Scenario: Duplicate Assignment Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment with all the necessary fields&lt;br /&gt;
   Then: Assignment already exists message is shown&lt;br /&gt;
&lt;br /&gt;
Scenario: Assignment Creation without all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment without all the necessary fields&lt;br /&gt;
   Then: Message to input fields is shown&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Grading Histories&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Grading History creation&lt;br /&gt;
Given: A team exists for a particular assignment and has a submission&lt;br /&gt;
When: An instructor assigns a grade for that submission&lt;br /&gt;
Then: The grading history entry is created&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Review Mapping&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Save Reviewer Grade and Comment&lt;br /&gt;
Given: A student has given a review for a submission&lt;br /&gt;
When: An instructor assigns a grade for the review&lt;br /&gt;
Then: The assigned grade and the accompanying comment are saved&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Grade&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Save Grade and Comment for Submission&lt;br /&gt;
Given: A team has made a submission for an assignment&lt;br /&gt;
When: An instructor assigns a grade for the submission&lt;br /&gt;
Then: The assigned grade and the accompanying comment are saved&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Tests ===&lt;br /&gt;
''Note: Discussion with mentor in progress to determine if UI Automation testing is in scope ''&lt;br /&gt;
*Student ID in header&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Student ID in grading history view &lt;br /&gt;
Logged in as an Instructor/Admin&lt;br /&gt;
  On Assignment page, click on Grading History&lt;br /&gt;
   Resulting Grading History Table is shown&lt;br /&gt;
    Student ID appears in the header, not in any table columns&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Assignment ID in header&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Assignment ID in grading history view &lt;br /&gt;
Logged in as an Instructor/Admin&lt;br /&gt;
  On Assignment page, click on Grading History&lt;br /&gt;
   Resulting Grading History Table is shown&lt;br /&gt;
    Assignment ID appears in the header, not in any table columns&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regression Testing ===&lt;br /&gt;
''In order to ensure complete coverage, testing of the changes done between the end of last semester and this project will be done to ensure that ''&lt;br /&gt;
''old test cases still pass.''&lt;br /&gt;
&lt;br /&gt;
# Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
# Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
&lt;br /&gt;
== Conclusions and Future Work ==&lt;br /&gt;
=== Comprehensive Testing and Scope ===&lt;br /&gt;
* '''Initial Thoughts:''' Current code coverage cannot be determined due to a combination of missing tests and simulation crashes. This will need to be fixed to enable monitoring of regular metrics, and adding comprehensive tests that target full code coverage.&lt;br /&gt;
* ''will be added for final submission''&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
''will be added for final submission''&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2164 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Fall 2021 - E2158. Grading audit trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc E1934 implementation video walkthrough]&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/ItrCCEY1jR8 Live Demo: Functionality]&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/9x59twFwwC0 RSpec Test Demo]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2399 Pull Request]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Submission_Grading_History_Table.jpeg&amp;diff=145425</id>
		<title>File:Submission Grading History Table.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Submission_Grading_History_Table.jpeg&amp;diff=145425"/>
		<updated>2022-04-26T03:52:05Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144653</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144653"/>
		<updated>2022-04-11T04:19:33Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: attempt to simplify and clarify write-up; fixes one Useful Link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Topic Overview &amp;amp; Prior Work (E2158) ==&lt;br /&gt;
=== Feature Overview ===&lt;br /&gt;
&lt;br /&gt;
[https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2158._Grading_audit_trail E2158] contains detailed information on the previous team's work with this feature. &lt;br /&gt;
&lt;br /&gt;
'''A summary of the desired functionality is presented below:'''&lt;br /&gt;
&lt;br /&gt;
Any instructor can assign or edit a grade freely. &lt;br /&gt;
&lt;br /&gt;
There should be a way to track which instructor assigned or edited a grade, along with any comments they wrote justifying that grade.&lt;br /&gt;
&lt;br /&gt;
These things must be recorded in the grading audit trail any time an instructor assigns or edits a grade and its comments:&lt;br /&gt;
* id of the instructor&lt;br /&gt;
* timestamp&lt;br /&gt;
Additionally, any comments written by other instructors should be preserved.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes By Previous Team ===&lt;br /&gt;
&lt;br /&gt;
*A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
**Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
*Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
*A view for displaying the grading history of a particular assignment or review was added ('''grading_histories/index.html.erb''').&lt;br /&gt;
&lt;br /&gt;
=== Files Modified By Previous Team ===&lt;br /&gt;
* \app\controllers\grades_controller.rb&lt;br /&gt;
* \app\controllers\grading_histories_controller.rb&lt;br /&gt;
* \app\controllers\review_mapping_controller.rb&lt;br /&gt;
* \app\helpers\grading_histories_helper.rb&lt;br /&gt;
* \app\models\grading_history.rb&lt;br /&gt;
* \app\models\review_grading_history.rb&lt;br /&gt;
* \app\models\submission_grading_history.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
* \app\views\grading_histories\index.html.erb&lt;br /&gt;
* \app\views\reports\_review_report.html.erb&lt;br /&gt;
* \config\routes.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Testing By Previous Team ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' were added.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
functional tests added to these files&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/models/grading_history.rb&lt;br /&gt;
: spec/controllers/grading_history_controller.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A ''feature test'' ensuring that a submission's grading history is shown completely, and in chronological order, was added.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==== Issues with Existing Tests ====&lt;br /&gt;
Only review_mapping_controller_spec.rb runs successfully--every other spec file mentioned above crashes.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
''There are '''three areas of focus''' for our team's project (E2237):''&lt;br /&gt;
=== System Crashes and Object Creation ===&lt;br /&gt;
&lt;br /&gt;
# We must ensure that the unit tests no longer crash, and that they pass with appropriate coverage.&lt;br /&gt;
# We must ensure that the creation of testing objects, namely Student Accounts, Assignments, and Project Bids, does not cause crashing.&lt;br /&gt;
&lt;br /&gt;
=== Changes to Grading History View ===&lt;br /&gt;
&lt;br /&gt;
The grading history table in the view is earmarked for certain changes:&lt;br /&gt;
# '''Student ID''' is a redundant field--move it to the page header.&lt;br /&gt;
# '''Assignment ID''' is a redundant field--move it to the page header.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The ''data flow'' for the grading history feature is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Reviewhistory.jpg]]&lt;br /&gt;
&lt;br /&gt;
The related ''table'' from the database is [https://expertiza.csc.ncsu.edu/index.php/Review_scores review_scores].&lt;br /&gt;
&lt;br /&gt;
The ER table of review_scores is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Review scores imported.png]]&lt;br /&gt;
&lt;br /&gt;
The latest ''flow'' for the Grading History functionality is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:GradingHistory.png]]&lt;br /&gt;
&lt;br /&gt;
=== Code and Documentation Goals ===&lt;br /&gt;
&lt;br /&gt;
We must explain changes made to files with diagrams and justifications.&lt;br /&gt;
&lt;br /&gt;
Explanations will be provided from these perspectives:&lt;br /&gt;
* data flow&lt;br /&gt;
* functions&lt;br /&gt;
* code comments&lt;br /&gt;
&lt;br /&gt;
== Planned and Completed Work ==&lt;br /&gt;
&lt;br /&gt;
=== General Design Goals ===&lt;br /&gt;
====Changes to the Grading History Table====&lt;br /&gt;
&lt;br /&gt;
The images below reference grading history view issues mentioned above in the ''Problem Statement''.&lt;br /&gt;
&lt;br /&gt;
To DRY the code, we will remove the redundant table data boxed below...&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; ...and we'll move it to the page header:&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_2.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====System Stability: Strategies====&lt;br /&gt;
''The source of crashing issues is currently unknown.'' To debug this, we will pursue the following:&lt;br /&gt;
* Refactor the specs and controllers&lt;br /&gt;
** Ensure DRY principle is followed&lt;br /&gt;
** Improve readability and maintainability&lt;br /&gt;
** Add code comments as needed &lt;br /&gt;
* Ensure testing objects do not cause crashes&lt;br /&gt;
&lt;br /&gt;
====Documentation====&lt;br /&gt;
# Changes to any files will be documented on this page; the programmatical reasoning behind the changes shall be explained, and will be in accordance with the DRY principle.&lt;br /&gt;
# Any changes to the overall program logic and data flow will be illustrated with UML diagrams in this document, along with the reasoning for any such changes.&lt;br /&gt;
# A pull request of the fixed code, fully commented, will be provided in this document.&lt;br /&gt;
&lt;br /&gt;
=== Specific Tasks Completed ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
# Verify that Student Accounts can be created and are saved to the database.&lt;br /&gt;
# Verify that Assignments can be created and are saved to the database.&lt;br /&gt;
# Verify that Project Bids can be created and are saved to the database.&lt;br /&gt;
# Ensure that Student ID is shown in the header, and verify via manual UI testing &lt;br /&gt;
# Ensure that Assignment ID is shown in the header, and verify via manual UI testing&lt;br /&gt;
# Finally, verify that tests can be run without crashing the system.&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
'''''Test cases provided here, will add RSpec code blocks for the final submission'''''&lt;br /&gt;
*Student Account&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Account Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create student account with all the necessary fields&lt;br /&gt;
   Then: Account is saved in the database&lt;br /&gt;
&lt;br /&gt;
Scenario: Duplicate Account Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create student accounts with all the necessary fields&lt;br /&gt;
   Then: Student already exists message is shown&lt;br /&gt;
&lt;br /&gt;
Scenario: Account Creation without all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create student accounts without all the necessary fields&lt;br /&gt;
   Then: Message to input fields is shown&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Assignments&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Assignment Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment with all the necessary fields&lt;br /&gt;
   Then: Assignment is saved in the database&lt;br /&gt;
&lt;br /&gt;
Scenario: Duplicate Assignment Creation with all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment with all the necessary fields&lt;br /&gt;
   Then: Assignment already exists message is shown&lt;br /&gt;
&lt;br /&gt;
Scenario: Assignment Creation without all fields &lt;br /&gt;
 Given: Logged in as an Instructor/Admin&lt;br /&gt;
  When: Create Assignment without all the necessary fields&lt;br /&gt;
   Then: Message to input fields is shown&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Project Bids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Project Bid creation&lt;br /&gt;
 Given: Logged in as a Student&lt;br /&gt;
  When: Complete Project Bid for open Project&lt;br /&gt;
   Then: Project Bid is saved in the database&lt;br /&gt;
&lt;br /&gt;
Scenario: Duplicate Project Bid  &lt;br /&gt;
 Given: Logged in as a Student&lt;br /&gt;
  When: Click on bid for open Project&lt;br /&gt;
   Then Message stating already selected shown&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Tests ===&lt;br /&gt;
''Note: Discussion with mentor in progress to determine if UI Automation testing is in scope ''&lt;br /&gt;
*Student ID in header&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Student ID in grading history view &lt;br /&gt;
Logged in as an Instructor/Admin&lt;br /&gt;
  On Assignment page, click on Grading History&lt;br /&gt;
   Resulting Grading History Table is shown&lt;br /&gt;
    Student ID appears in the header, not in any table columns&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Assignment ID in header&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Scenario: Assignment ID in grading history view &lt;br /&gt;
Logged in as an Instructor/Admin&lt;br /&gt;
  On Assignment page, click on Grading History&lt;br /&gt;
   Resulting Grading History Table is shown&lt;br /&gt;
    Assignment ID appears in the header, not in any table columns&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Regression Testing ===&lt;br /&gt;
''In order to ensure complete coverage, testing of the changes done between the end of last semester and this project will be done to ensure that ''&lt;br /&gt;
''old test cases still pass.''&lt;br /&gt;
&lt;br /&gt;
# Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
# Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
&lt;br /&gt;
== Conclusions and Future Work ==&lt;br /&gt;
=== Comprehensive Testing and Scope ===&lt;br /&gt;
* '''Initial Thoughts:''' Current code coverage cannot be determined due to a combination of missing tests and simulation crashes. This will need to be fixed to enable monitoring of regular metrics, and adding comprehensive tests that target full code coverage.&lt;br /&gt;
* ''will be added for final submission''&lt;br /&gt;
&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
''will be added for final submission''&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2164 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[CSC/ECE 517 Fall 2021 - E2158. Grading audit trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc E1934 implementation video walkthrough]&lt;br /&gt;
&lt;br /&gt;
== Contributors ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144190</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144190"/>
		<updated>2022-04-06T03:07:41Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: add second photo of work to be done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Topic Overview &amp;amp; Prior Work ==&lt;br /&gt;
&lt;br /&gt;
The [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2158._Grading_audit_trail previous team's work] contains detailed information regarding this feature. A summary of the desired functionality is presented below:&lt;br /&gt;
&lt;br /&gt;
After an instructor assigns a grade to an assignment, there should be a way to track who gave the grade. Any instructor can assign/edit a grade freely; a grading audit trail must be created and the following information needs to be stored:&lt;br /&gt;
&amp;lt;br&amp;gt;1. When a grade is assigned by an instructor, there must be an indication of the InstructorID and a timestamp of the change.&lt;br /&gt;
&amp;lt;br&amp;gt;2. Comments previously provided by other instructors must be preserved.&lt;br /&gt;
&lt;br /&gt;
This information needs to be stored every time an instructor edits a grade/comment and clicks the save button.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
* \app\controllers\grades_controller.rb&lt;br /&gt;
* \app\controllers\grading_histories_controller.rb&lt;br /&gt;
* \app\controllers\review_mapping_controller.rb&lt;br /&gt;
* \app\helpers\grading_histories_helper.rb&lt;br /&gt;
* \app\models\grading_history.rb&lt;br /&gt;
* \app\models\review_grading_history.rb&lt;br /&gt;
* \app\models\submission_grading_history.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
* \app\views\grading_histories\index.html.erb&lt;br /&gt;
* \app\views\reports\_review_report.html.erb&lt;br /&gt;
* \config\routes.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Testing (NOTE: should probably remove this from here) ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
== Statement of Problem ==&lt;br /&gt;
''There are three areas of focus for this project:''&lt;br /&gt;
=== System Crashes and Object Creation ===&lt;br /&gt;
&lt;br /&gt;
First, the work done by the previous team results in the system crashing when the tests are being executed; as a result, automated unit testing does not succeed.&lt;br /&gt;
Our goal in this regard is to ensure that the tests are successfully executed for all test cases, with the appropriate outcome and coverage reports visible to the user.&lt;br /&gt;
&lt;br /&gt;
Second, testing efforts to this point have used static, pre-created objects; this is due to issues with object creation. &lt;br /&gt;
Our goal in this aspect is to ensure that the creation of new test objects, namely Student Accounts, Assignments, and Project Bids is successful.  &lt;br /&gt;
&lt;br /&gt;
=== Changes to Grading History Table ===&lt;br /&gt;
&lt;br /&gt;
The grading history table is earmarked for certain changes:&lt;br /&gt;
&amp;lt;br&amp;gt;a. Extract Student ID from the table, and ensure that it is shown in the header&lt;br /&gt;
&amp;lt;br&amp;gt;b. Extract Assignment ID from the table, and ensure that it is shown in the header&lt;br /&gt;
&lt;br /&gt;
=== Code and Documentation Goals ===&lt;br /&gt;
&lt;br /&gt;
Add reasonings and data flow structures/UML diagrams that detail the changes that have been made, as well as any comments on why certain files needed to be modified.&lt;br /&gt;
These will be completed from these perspectives:&lt;br /&gt;
&amp;lt;br&amp;gt;a. From a data flow point of view&lt;br /&gt;
&amp;lt;br&amp;gt;b. From a function point of view&lt;br /&gt;
&amp;lt;br&amp;gt;c. With comment in code&lt;br /&gt;
&lt;br /&gt;
== Plan and List of Work Done ==&lt;br /&gt;
&lt;br /&gt;
=== General Design Goals ===&lt;br /&gt;
* '''''Changes to the Grading History Table: the following lines are required to be modified to complete this objective:'''''&lt;br /&gt;
The highlighted code here is to be removed in order to remove redundant data from the table&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; The data is to be moved to the header, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Specific Tasks Completed ===&lt;br /&gt;
&lt;br /&gt;
== Initial Implementation ==&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
1. Verify that Student Accounts can be created and are saved to the database.&lt;br /&gt;
2. Verify that Assignments can be created and are saved to the database.&lt;br /&gt;
3. Verify that Project Bids can be created and are saved to the database.&lt;br /&gt;
4. Ensure that Student ID is shown in the header via RSpec, and verify via manual UI testing &lt;br /&gt;
5. Ensure that Assignment ID is shown in the header via RSpec, and verify via manual UI testing &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
=== General Testing Plan ===&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
=== Manual UI Tests ===&lt;br /&gt;
''Discussion with mentor in progress to determine if UI Automation testing is in scope ''&lt;br /&gt;
=== Regression Testing ===&lt;br /&gt;
'''In order to ensure complete coverage, testing of the changes done  between the end of last semester and this project was done.'''&lt;br /&gt;
&lt;br /&gt;
''Note to team: need to edit this after investigation''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;1. Investigate if this is testable using Capybara&lt;br /&gt;
&amp;lt;br&amp;gt;2. Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
&amp;lt;br&amp;gt;3. Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
&amp;lt;br&amp;gt;4. Inquire with mentor about comment requirement and conflicts&lt;br /&gt;
&amp;lt;br&amp;gt;5. Inquire with mentor regarding white space constraints&lt;br /&gt;
&amp;lt;br&amp;gt;6. Inquire why the revert is needed, what is breaking and why&lt;br /&gt;
&amp;lt;br&amp;gt;7. Ask mentor where this file is being called, and if functionality needs to be moved elsewhere. &lt;br /&gt;
&amp;lt;br&amp;gt;8. Complete Design Document to reflect these changes.&lt;br /&gt;
&lt;br /&gt;
== Conclusions and Future Work ==&lt;br /&gt;
=== Thoughts on Comprehensive Testing and Scope ===&lt;br /&gt;
=== Test Plan Document (SoP) ===&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc E1934 implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144189</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144189"/>
		<updated>2022-04-06T03:07:01Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: add first photo of work to be done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Topic Overview &amp;amp; Prior Work ==&lt;br /&gt;
&lt;br /&gt;
The [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2021_-_E2158._Grading_audit_trail previous team's work] contains detailed information regarding this feature. A summary of the desired functionality is presented below:&lt;br /&gt;
&lt;br /&gt;
After an instructor assigns a grade to an assignment, there should be a way to track who gave the grade. Any instructor can assign/edit a grade freely; a grading audit trail must be created and the following information needs to be stored:&lt;br /&gt;
&amp;lt;br&amp;gt;1. When a grade is assigned by an instructor, there must be an indication of the InstructorID and a timestamp of the change.&lt;br /&gt;
&amp;lt;br&amp;gt;2. Comments previously provided by other instructors must be preserved.&lt;br /&gt;
&lt;br /&gt;
This information needs to be stored every time an instructor edits a grade/comment and clicks the save button.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
=== Files Involved ===&lt;br /&gt;
* \app\controllers\grades_controller.rb&lt;br /&gt;
* \app\controllers\grading_histories_controller.rb&lt;br /&gt;
* \app\controllers\review_mapping_controller.rb&lt;br /&gt;
* \app\helpers\grading_histories_helper.rb&lt;br /&gt;
* \app\models\grading_history.rb&lt;br /&gt;
* \app\models\review_grading_history.rb&lt;br /&gt;
* \app\models\submission_grading_history.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
* \app\views\grading_histories\index.html.erb&lt;br /&gt;
* \app\views\reports\_review_report.html.erb&lt;br /&gt;
* \config\routes.rb&lt;br /&gt;
* \app\views\assignments\list_submissions.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Testing (NOTE: should probably remove this from here) ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
== Statement of Problem ==&lt;br /&gt;
''There are three areas of focus for this project:''&lt;br /&gt;
=== System Crashes and Object Creation ===&lt;br /&gt;
&lt;br /&gt;
First, the work done by the previous team results in the system crashing when the tests are being executed; as a result, automated unit testing does not succeed.&lt;br /&gt;
Our goal in this regard is to ensure that the tests are successfully executed for all test cases, with the appropriate outcome and coverage reports visible to the user.&lt;br /&gt;
&lt;br /&gt;
Second, testing efforts to this point have used static, pre-created objects; this is due to issues with object creation. &lt;br /&gt;
Our goal in this aspect is to ensure that the creation of new test objects, namely Student Accounts, Assignments, and Project Bids is successful.  &lt;br /&gt;
&lt;br /&gt;
=== Changes to Grading History Table ===&lt;br /&gt;
&lt;br /&gt;
The grading history table is earmarked for certain changes:&lt;br /&gt;
&amp;lt;br&amp;gt;a. Extract Student ID from the table, and ensure that it is shown in the header&lt;br /&gt;
&amp;lt;br&amp;gt;b. Extract Assignment ID from the table, and ensure that it is shown in the header&lt;br /&gt;
&lt;br /&gt;
=== Code and Documentation Goals ===&lt;br /&gt;
&lt;br /&gt;
Add reasonings and data flow structures/UML diagrams that detail the changes that have been made, as well as any comments on why certain files needed to be modified.&lt;br /&gt;
These will be completed from these perspectives:&lt;br /&gt;
&amp;lt;br&amp;gt;a. From a data flow point of view&lt;br /&gt;
&amp;lt;br&amp;gt;b. From a function point of view&lt;br /&gt;
&amp;lt;br&amp;gt;c. With comment in code&lt;br /&gt;
&lt;br /&gt;
== Plan and List of Work Done ==&lt;br /&gt;
&lt;br /&gt;
=== General Design Goals ===&lt;br /&gt;
* '''''Changes to the Grading History Table: the following lines are required to be modified to complete this objective:'''''&lt;br /&gt;
The highlighted code here is to be removed in order to remove redundant data from the table&lt;br /&gt;
&lt;br /&gt;
[[File:E2237_Proj4_1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; The data is to be moved to the header, as shown below:&lt;br /&gt;
&lt;br /&gt;
=== Specific Tasks Completed ===&lt;br /&gt;
&lt;br /&gt;
== Initial Implementation ==&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
''will be added for the final submission''&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
&lt;br /&gt;
''Drawing from the project objectives:''&lt;br /&gt;
1. Verify that Student Accounts can be created and are saved to the database.&lt;br /&gt;
2. Verify that Assignments can be created and are saved to the database.&lt;br /&gt;
3. Verify that Project Bids can be created and are saved to the database.&lt;br /&gt;
4. Ensure that Student ID is shown in the header via RSpec, and verify via manual UI testing &lt;br /&gt;
5. Ensure that Assignment ID is shown in the header via RSpec, and verify via manual UI testing &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
=== General Testing Plan ===&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
=== Manual UI Tests ===&lt;br /&gt;
''Discussion with mentor in progress to determine if UI Automation testing is in scope ''&lt;br /&gt;
=== Regression Testing ===&lt;br /&gt;
'''In order to ensure complete coverage, testing of the changes done  between the end of last semester and this project was done.'''&lt;br /&gt;
&lt;br /&gt;
''Note to team: need to edit this after investigation''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;1. Investigate if this is testable using Capybara&lt;br /&gt;
&amp;lt;br&amp;gt;2. Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
&amp;lt;br&amp;gt;3. Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
&amp;lt;br&amp;gt;4. Inquire with mentor about comment requirement and conflicts&lt;br /&gt;
&amp;lt;br&amp;gt;5. Inquire with mentor regarding white space constraints&lt;br /&gt;
&amp;lt;br&amp;gt;6. Inquire why the revert is needed, what is breaking and why&lt;br /&gt;
&amp;lt;br&amp;gt;7. Ask mentor where this file is being called, and if functionality needs to be moved elsewhere. &lt;br /&gt;
&amp;lt;br&amp;gt;8. Complete Design Document to reflect these changes.&lt;br /&gt;
&lt;br /&gt;
== Conclusions and Future Work ==&lt;br /&gt;
=== Thoughts on Comprehensive Testing and Scope ===&lt;br /&gt;
=== Test Plan Document (SoP) ===&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc E1934 implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2237_Proj4_2.png&amp;diff=144187</id>
		<title>File:E2237 Proj4 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2237_Proj4_2.png&amp;diff=144187"/>
		<updated>2022-04-06T03:04:39Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2237_Proj4_1.png&amp;diff=144186</id>
		<title>File:E2237 Proj4 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2237_Proj4_1.png&amp;diff=144186"/>
		<updated>2022-04-06T03:04:01Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144144</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=144144"/>
		<updated>2022-04-06T01:14:49Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: fix a missing heading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Topic Overview ==&lt;br /&gt;
&lt;br /&gt;
=== Prior Work ===&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of the [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
==== Overview of Major Changes ====&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
==== Modifications to Existing Files ====&lt;br /&gt;
&lt;br /&gt;
;app/controllers/grades_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a submission's grade.&lt;br /&gt;
;app/controllers/review_mapping_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a review's grade.&lt;br /&gt;
;app/views/assignments/list_submissions.html.erb&lt;br /&gt;
: A link to access a submission's grade history is shown in the submissions table.&lt;br /&gt;
;app/views/reports/_review_report.html.erb&lt;br /&gt;
: A link to access a review's grade history is shown in the review report table.&lt;br /&gt;
&lt;br /&gt;
==== Testing (NOTE: should probably remove this from here) ====&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Statement of Problem ===&lt;br /&gt;
&lt;br /&gt;
# For review grades, the “Grading History” link must not be in a separate column. It should be in smaller text below the “Save” button. &lt;br /&gt;
# In the view grading record page, remove the receiver column and add it to the title &lt;br /&gt;
# Restrict the column width on the grading record page &lt;br /&gt;
# Add comments on '''list_submissions.html.erb''' to indicate that the alignment was changed to fix code climate issues &lt;br /&gt;
# Ensure that white space changes are separate commits &lt;br /&gt;
# Revert changes made to '''list_review_mapping.html.erb''' &lt;br /&gt;
# Remove the '''_review_report.html.erb''' file&lt;br /&gt;
# Design doc – mention why each of those files were changed&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Plan and List of Work Done ==&lt;br /&gt;
&lt;br /&gt;
=== General Design Goals ===&lt;br /&gt;
=== Specific Tasks Completed ===&lt;br /&gt;
&lt;br /&gt;
== Initial Implementation ==&lt;br /&gt;
&lt;br /&gt;
== Final Implementation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
=== Video Demonstration ===&lt;br /&gt;
=== Testing Goals and Test Objects ===&lt;br /&gt;
=== General Testing Plan ===&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
=== Manual UI Tests ===&lt;br /&gt;
''Discussion with mentor in progress to determine if UI Automation testing is in scope ''&lt;br /&gt;
=== Regression Testing ===&lt;br /&gt;
'''In order to ensure complete coverage, testing of the changes done  between the end of last semester and this project was done.'''&lt;br /&gt;
&lt;br /&gt;
''Note to team: need to edit this after investigation''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;1. Investigate if this is testable using Capybara&lt;br /&gt;
&amp;lt;br&amp;gt;2. Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
&amp;lt;br&amp;gt;3. Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
&amp;lt;br&amp;gt;4. Inquire with mentor about comment requirement and conflicts&lt;br /&gt;
&amp;lt;br&amp;gt;5. Inquire with mentor regarding white space constraints&lt;br /&gt;
&amp;lt;br&amp;gt;6. Inquire why the revert is needed, what is breaking and why&lt;br /&gt;
&amp;lt;br&amp;gt;7. Ask mentor where this file is being called, and if functionality needs to be moved elsewhere. &lt;br /&gt;
&amp;lt;br&amp;gt;8. Complete Design Document to reflect these changes.&lt;br /&gt;
&lt;br /&gt;
== Conclusions and Future Work ==&lt;br /&gt;
=== Thoughts on Comprehensive Testing and Scope ===&lt;br /&gt;
=== Test Plan Document (SoP) ===&lt;br /&gt;
=== Conclusion ===&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc E1934 implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143881</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143881"/>
		<updated>2022-04-01T00:36:07Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
# For review grades, the “Grading History” link must not be in a separate column. It should be in smaller text below the “Save” button. &lt;br /&gt;
# In the view grading record page, remove the receiver column and add it to the title &lt;br /&gt;
# Restrict the column width on the grading record page &lt;br /&gt;
# Add comments on '''list_submissions.html.erb''' to indicate that the alignment was changed to fix code climate issues &lt;br /&gt;
# Ensure that white space changes are separate commits &lt;br /&gt;
# Revert changes made to '''list_review_mapping.html.erb''' &lt;br /&gt;
# Remove the '''_review_report.html.erb''' file&lt;br /&gt;
# Design doc – mention why each of those files were changed&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of the [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Modifications to Existing Files ===&lt;br /&gt;
&lt;br /&gt;
;app/controllers/grades_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a submission's grade.&lt;br /&gt;
;app/controllers/review_mapping_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a review's grade.&lt;br /&gt;
;app/views/assignments/list_submissions.html.erb&lt;br /&gt;
: A link to access a submission's grade history is shown in the submissions table.&lt;br /&gt;
;app/views/reports/_review_report.html.erb&lt;br /&gt;
: A link to access a review's grade history is shown in the review report table.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
(in progress)&lt;br /&gt;
1. Investigate if this is testable using Capybara&lt;br /&gt;
2. Get the specific format requirement for the title, and assert that it's there. Ensure that this doesn't appear anywhere else (possible via ensuring count is 1)&lt;br /&gt;
3. Procure specific required column width, and assert that this is the value in the file (the constant)&lt;br /&gt;
4. Inquire with mentor about comment requirement and conflicts&lt;br /&gt;
5. Inquire with mentor regarding white space constraints&lt;br /&gt;
6. Inquire why the revert is needed, what is breaking and why&lt;br /&gt;
7. &lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143878</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143878"/>
		<updated>2022-04-01T00:08:54Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
# For review grades, the “Grading History” link must not be in a separate column. It should be in smaller text below the “Save” button. &lt;br /&gt;
# In the view grading record page, remove the receiver column and add it to the title &lt;br /&gt;
# Restrict the column width on the grading record page &lt;br /&gt;
# Add comments on '''list_submissions.html.erb''' to indicate that the alignment was changed to fix code climate issues &lt;br /&gt;
# Ensure that white space changes are separate commits &lt;br /&gt;
# Revert changes made to '''list_review_mapping.html.erb''' &lt;br /&gt;
# Remove the '''review_report-html.erb''' file&lt;br /&gt;
# Design doc – mention why each of those files were changed&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of the [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Modifications to Existing Files ===&lt;br /&gt;
&lt;br /&gt;
;app/controllers/grades_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a submission's grade.&lt;br /&gt;
;app/controllers/review_mapping_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a review's grade.&lt;br /&gt;
;app/views/assignments/list_submissions.html.erb&lt;br /&gt;
: A link to access a submission's grade history is shown in the submissions table.&lt;br /&gt;
;app/views/reports/_review_report.html.erb&lt;br /&gt;
: A link to access a review's grade history is shown in the review report table.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143876</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143876"/>
		<updated>2022-03-31T23:59:01Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
# For review grades, the “Grading History” link must not be in a separate column. It should be in smaller text below the in the “Save” button. &lt;br /&gt;
# In the view grading record page, remove the receiver column and add it to the title &lt;br /&gt;
# Restrict the column width on the grading record page &lt;br /&gt;
# Add comments on '''list_submissions.html.erb''' to indicate that the alignment was changed to fix code climate issues &lt;br /&gt;
# Ensure that white space changes are separate commits &lt;br /&gt;
# Revert changes made to '''list_review_mapping.html.erb''' &lt;br /&gt;
# Remove the '''review_report-html.erb''' file&lt;br /&gt;
# Design doc – mention why each of those files were changed&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of the [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Modifications to Existing Files ===&lt;br /&gt;
&lt;br /&gt;
;app/controllers/grades_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a submission's grade.&lt;br /&gt;
;app/controllers/review_mapping_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a review's grade.&lt;br /&gt;
;app/views/assignments/list_submissions.html.erb&lt;br /&gt;
: A link to access a submission's grade history is shown in the submissions table.&lt;br /&gt;
;app/views/reports/_review_report.html.erb&lt;br /&gt;
: A link to access a review's grade history is shown in the review report table.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143874</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143874"/>
		<updated>2022-03-31T23:31:22Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Summary of Previous Team's Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of the [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Modifications to Existing Files ===&lt;br /&gt;
&lt;br /&gt;
;app/controllers/grades_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a submission's grade.&lt;br /&gt;
;app/controllers/review_mapping_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a review's grade.&lt;br /&gt;
;app/views/assignments/list_submissions.html.erb&lt;br /&gt;
: A link to access a submission's grade history is shown in the submissions table.&lt;br /&gt;
;app/views/reports/_review_report.html.erb&lt;br /&gt;
: A link to access a review's grade history is shown in the review report table.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143873</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143873"/>
		<updated>2022-03-31T23:30:43Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Modifications to Existing Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Modifications to Existing Files ===&lt;br /&gt;
&lt;br /&gt;
;app/controllers/grades_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a submission's grade.&lt;br /&gt;
;app/controllers/review_mapping_controller.rb&lt;br /&gt;
: A grading history record is created for every edit to a review's grade.&lt;br /&gt;
;app/views/assignments/list_submissions.html.erb&lt;br /&gt;
: A link to access a submission's grade history is shown in the submissions table.&lt;br /&gt;
;app/views/reports/_review_report.html.erb&lt;br /&gt;
: A link to access a review's grade history is shown in the review report table.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143872</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143872"/>
		<updated>2022-03-31T23:18:25Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Summary of Previous Team's Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== Overview of Major Changes ===&lt;br /&gt;
&lt;br /&gt;
A new table was added to the database ('''grading_history'''), along with the corresponding model ('''grading_history.rb''') and controller ('''grading_history_controller.rb''').&lt;br /&gt;
&lt;br /&gt;
Two models for specific types of histories were added: '''review_grading_history.rb''', and '''submission_grading_history.rb'''.&lt;br /&gt;
&lt;br /&gt;
A view for displaying the grading history of a particular assignment or review was added ('''index_html.erb''').&lt;br /&gt;
&lt;br /&gt;
Whenever an instructor submits a new grade, or edits an existing grade, the '''grading_history_controller''' saves a new history entry to the database.&lt;br /&gt;
&lt;br /&gt;
=== Modifications to Existing Files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
''Functional tests'' ensuring specific method calls are made were added.&lt;br /&gt;
&lt;br /&gt;
;functional tests added to these files&lt;br /&gt;
: spec/controllers/grades_controller_spec.rb&lt;br /&gt;
: spec/controllers/review_mapping_controller_spec.rb&lt;br /&gt;
: spec/controllers/grading_histories_controller_test.rb&lt;br /&gt;
&lt;br /&gt;
A ''feature test'' ensuring that correct grading history is shown in chronological order was added.&lt;br /&gt;
&lt;br /&gt;
;feature test handled by these two files&lt;br /&gt;
: spec/features/grade_histories_spec.rb&lt;br /&gt;
: spec/features/helpers/grade_histories_helper.rb&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143871</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143871"/>
		<updated>2022-03-31T22:19:58Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Useful Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== MVC Changes ===&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/1441 Previous team's Expertiza GitHub pull request]&lt;br /&gt;
&lt;br /&gt;
[[E1934 - Grading Audit Trail|Previous team's wiki write-up]]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=yyxX_kRYxLc Previous team's implementation video walkthrough]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143870</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143870"/>
		<updated>2022-03-31T22:15:26Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Mentor */ add bullet point for consistency&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
*Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== MVC Changes ===&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143869</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143869"/>
		<updated>2022-03-31T22:15:06Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Mentor */ add team mentor&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
Kai Xiao (''yxiao28'')&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== MVC Changes ===&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143868</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143868"/>
		<updated>2022-03-31T22:14:23Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Students */ add student team members&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
*Bhuwan Bhatt (''brbhatt'')&lt;br /&gt;
*Soumyadeep Chatterjee (''schatte5'')&lt;br /&gt;
*Kelly Fleming (''kflemin3'')&lt;br /&gt;
*Karthik Gopala Sundaresan (''kgopala3'')&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== MVC Changes ===&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143867</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143867"/>
		<updated>2022-03-31T22:10:08Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Summary of Previous Team's Work */ add link to relevant wiki page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
You can read the entirety of [[E1934 - Grading Audit Trail|previous team's wiki write-up]] if desired.&lt;br /&gt;
&lt;br /&gt;
=== MVC Changes ===&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143866</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143866"/>
		<updated>2022-03-31T22:08:50Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: heading skeleton&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Students ===&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
== Summary of Previous Team's Work ==&lt;br /&gt;
&lt;br /&gt;
=== MVC Changes ===&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
== Our Team's Design Proposal ==&lt;br /&gt;
&lt;br /&gt;
== Useful Links ==&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022&amp;diff=143864</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=143864"/>
		<updated>2022-03-31T21:56:03Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: add E2237 to list of final projects for spring 2022 semester&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 - E2241: Heatgrid fixes and improvements]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2022 - E2237: Grading audit trail]]&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143862</id>
		<title>CSC/ECE 517 Spring 2022 - E2237: Grading audit trail</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail&amp;diff=143862"/>
		<updated>2022-03-31T21:54:36Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: create project page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Under Construction ==&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Kflemin3&amp;diff=143861</id>
		<title>User:Kflemin3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Kflemin3&amp;diff=143861"/>
		<updated>2022-03-31T21:53:44Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: make links nice&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Spring 2022 CSC 517 student&lt;br /&gt;
&lt;br /&gt;
worked on [[CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller|E2214. Refactor teams controller]]&lt;br /&gt;
&lt;br /&gt;
worked on [[CSC/ECE_517_Spring_2022_-_E2237:_Grading_audit_trail|E2237. Grading audit trail]]&lt;br /&gt;
&lt;br /&gt;
feel free to contact me at '''kflemin3@ncsu.edu''' with questions about those topics&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Kflemin3&amp;diff=143859</id>
		<title>User:Kflemin3</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Kflemin3&amp;diff=143859"/>
		<updated>2022-03-31T21:45:56Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: create kflemin3 user page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Spring 2022 CSC 517 student&lt;br /&gt;
&lt;br /&gt;
worked on [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller E2214 Refactor teams_controller.rb]&lt;br /&gt;
&lt;br /&gt;
worked on [http://www.example.com E2237 Grading audit trail]&lt;br /&gt;
&lt;br /&gt;
you can contact me at '''kflemin3@ncsu.edu''' with questions about those topics&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller&amp;diff=143086</id>
		<title>CSC/ECE 517 Spring 2022 - E2214: Refactor teams controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller&amp;diff=143086"/>
		<updated>2022-03-20T22:34:59Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: /* Scope for future improvement */  fixes typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E2214 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
&lt;br /&gt;
Instructor Login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open-source project developed on the Ruby on Rails platform and its code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with the models, views, and controllers of Teams. Core to any online learning platform is the ability of students and instructors to create and delete teams. Teams_Controller primarily handles the creation, deletion, and other behaviors of course teams and assignment teams. Most of its methods are called from the instructor’s point of view in expertiza. This controller has some problems that violate some essential Rails design principles. There are a few methods in this controller that should have been in model classes. Some methods share code, which creates code repetition. Our project primarily focuses on refactoring some complex methods that involve high branching, removing redundant and dead code, modularising common functionalities, and condensing the existing bad code into a few lines to achieve the same functionality. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
Controller, model and views were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Teams Controller: teams_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Teams Model: team.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Teams Views&lt;br /&gt;
* list.html.erb&lt;br /&gt;
* new.html.erb&lt;br /&gt;
* _team.html.erb&lt;br /&gt;
4. (Generic)Tree Display Views&lt;br /&gt;
* _page_footer.html.erb&lt;br /&gt;
* _entry_html.erb&lt;br /&gt;
* _folder.html.erb&lt;br /&gt;
* _listing.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Teams Controller ===&lt;br /&gt;
&lt;br /&gt;
The controller contains all the methods to perform CRUD operations on the teams when seen from the instructor's point of view in the UI.&lt;br /&gt;
&lt;br /&gt;
==== List of changes ====&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Move allowed types list constant in list method to model as it is a best practice to keep all the constants at one place.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Refactor delete method. This method deletes the team and erases the records from teams_users and signed_up_teams table.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor inherit and bequeath_all methods. Both the methods contain duplicated code with nested branching statements.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Introduce new methods like init_team_type, get_parent_by_id, get_parent_from_child which commonly operate on fetching team type to render UI elements accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Fix for a flaky test case on creating teams with the random members method.&lt;br /&gt;
&lt;br /&gt;
==== Solutions Implemented and Delivered ====&lt;br /&gt;
 &lt;br /&gt;
1. Refactoring in the list method.&lt;br /&gt;
The list method contains a list of constants to check if the team_type from the session variables is a valid one or not. &lt;br /&gt;
&lt;br /&gt;
Existing code snippet in teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
allowed_types = %w[Assignment Course]&lt;br /&gt;
session[:team_type] = params[:type] if params[:type] &amp;amp;&amp;amp; allowed_types.include?(params[:type])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have moved the constant allowed_types to the teams model so that it can be used wherever needed in the teams_controller.rb.&amp;lt;br&amp;gt;&lt;br /&gt;
Code snippet after refactoring in team.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Allowed types of teams -- ASSIGNMENT teams or COURSE teams&lt;br /&gt;
def self.allowed_types&lt;br /&gt;
  # non-interpolated array of single-quoted strings&lt;br /&gt;
  %w[Assignment Course]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring showing the usage in teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session[:team_type] = params[:type] if params[:type] &amp;amp;&amp;amp; Team.allowed_types.include?(params[:type])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Refactor delete method.&lt;br /&gt;
This method contains an if block in which the condition is never satisfied. It is considered a dead code. Related piazza post: https://piazza.com/class/kxwmkrv8djq573?cid=210&lt;br /&gt;
&lt;br /&gt;
So we have simply removed that if block. Below is the removed code snippet.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if @signed_up_team == 1 &amp;amp;&amp;amp; !@signUps.first.is_waitlisted # this team hold a topic&lt;br /&gt;
   # if there is another team in waitlist, make this team hold this topic&lt;br /&gt;
   topic_id = @signed_up_team.first.topic_id&lt;br /&gt;
   next_wait_listed_team = SignedUpTeam.where(topic_id: topic_id, is_waitlisted: true).first&lt;br /&gt;
   # if slot exist, then confirm the topic for this team and delete all waitlists for this team&lt;br /&gt;
   SignUpTopic.assign_to_first_waiting_team(next_wait_listed_team) if next_wait_listed_team&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And also there is a statement at line 89 which we replaced with &amp;lt;pre&amp;gt;@team.destroy&amp;lt;/pre&amp;gt; instead of &amp;lt;pre&amp;gt;@team.destroy if @team&amp;lt;/pre&amp;gt; because we already have a nil check for this variable in line 74, so we can remove the redundant ones.&lt;br /&gt;
&lt;br /&gt;
3. Refactor inherit and bequeath_all methods.&lt;br /&gt;
Both methods contain a piece of code in common. They also have high branching in them which makes the code readability much more difficult.&lt;br /&gt;
Existing Code Snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copies existing teams from a course down to an assignment&lt;br /&gt;
# The team and team members are all copied.&lt;br /&gt;
def inherit&lt;br /&gt;
 assignment = Assignment.find(params[:id])&lt;br /&gt;
 if assignment.course_id&lt;br /&gt;
   course = Course.find(assignment.course_id)&lt;br /&gt;
   teams = course.get_teams&lt;br /&gt;
   if teams.empty?&lt;br /&gt;
     flash[:note] = 'No teams were found when trying to inherit.'&lt;br /&gt;
   else&lt;br /&gt;
     teams.each do |team|&lt;br /&gt;
       team.copy(assignment.id)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 else&lt;br /&gt;
   flash[:error] = 'No course was found for this assignment.'&lt;br /&gt;
 end&lt;br /&gt;
 redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def bequeath_all&lt;br /&gt;
 if session[:team_type] == 'Course'&lt;br /&gt;
   flash[:error] = 'Invalid team type for bequeathal'&lt;br /&gt;
   redirect_to controller: 'teams', action: 'list', id: params[:id]&lt;br /&gt;
   return&lt;br /&gt;
 end&lt;br /&gt;
 assignment = Assignment.find(params[:id])&lt;br /&gt;
 if assignment.course_id&lt;br /&gt;
   course = Course.find(assignment.course_id)&lt;br /&gt;
   if course.course_teams.any?&lt;br /&gt;
     flash[:error] = 'The course already has associated teams'&lt;br /&gt;
     redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
     return&lt;br /&gt;
   end&lt;br /&gt;
   teams = assignment.teams&lt;br /&gt;
   teams.each do |team|&lt;br /&gt;
     team.copy(course.id)&lt;br /&gt;
   end&lt;br /&gt;
   flash[:note] = teams.length.to_s + ' teams were successfully copied to &amp;quot;' + course.name + '&amp;quot;'&lt;br /&gt;
 else&lt;br /&gt;
   flash[:error] = 'No course was found for this assignment.'&lt;br /&gt;
 end&lt;br /&gt;
 redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a solution for this problem, we have separated the bigger functions and broken them into smaller ones as below.&lt;br /&gt;
Code snippet after refactoring in teams_controller.rb.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copies existing teams from a course down to an assignment&lt;br /&gt;
# The team and team members are all copied.&lt;br /&gt;
def inherit&lt;br /&gt;
 copy_teams(Team.team_operation[:inherit])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Handovers all teams to the course that contains the corresponding assignment&lt;br /&gt;
# The team and team members are all copied.&lt;br /&gt;
def bequeath_all&lt;br /&gt;
 if session[:team_type] == 'Course'&lt;br /&gt;
   flash[:error] = 'Invalid team type for bequeath all'&lt;br /&gt;
   redirect_to controller: 'teams', action: 'list', id: params[:id]&lt;br /&gt;
 else&lt;br /&gt;
   copy_teams(Team.team_operation[:bequeath])&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
private&lt;br /&gt;
&lt;br /&gt;
# Method to abstract the functionality to copy teams.&lt;br /&gt;
def copy_teams(operation)&lt;br /&gt;
 assignment = Assignment.find(params[:id])&lt;br /&gt;
 if assignment.course_id&lt;br /&gt;
   choose_copy_type(assignment, operation)&lt;br /&gt;
 else&lt;br /&gt;
   flash[:error] = 'No course was found for this assignment.'&lt;br /&gt;
 end&lt;br /&gt;
 redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Method to choose copy technique based on the operation type.&lt;br /&gt;
def choose_copy_type(assignment, operation)&lt;br /&gt;
 course = Course.find(assignment.course_id)&lt;br /&gt;
 if operation == Team.team_operation[:bequeath]&lt;br /&gt;
   bequeath_copy(assignment, course)&lt;br /&gt;
 else&lt;br /&gt;
   inherit_copy(assignment, course)&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Method to perform a copy of assignment teams to course&lt;br /&gt;
def bequeath_copy(assignment, course)&lt;br /&gt;
 teams = assignment.teams&lt;br /&gt;
 if course.course_teams.any?&lt;br /&gt;
   flash[:error] = 'The course already has associated teams'&lt;br /&gt;
 else&lt;br /&gt;
   Team.copy_content(teams, course)&lt;br /&gt;
   flash[:note] = teams.length.to_s + ' teams were successfully copied to &amp;quot;' + course.name + '&amp;quot;'&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Method to inherit teams from course by copying&lt;br /&gt;
def inherit_copy(assignment, course)&lt;br /&gt;
 teams = course.course_teams&lt;br /&gt;
 if teams.empty?&lt;br /&gt;
   flash[:error] = 'No teams were found when trying to inherit.'&lt;br /&gt;
 else&lt;br /&gt;
   Team.copy_content(teams, assignment)&lt;br /&gt;
   flash[:note] = teams.length.to_s + ' teams were successfully copied to &amp;quot;' + assignment.name + '&amp;quot;'&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring in team.rb.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# copies content of one object to the another&lt;br /&gt;
def self.copy_content(source, destination)&lt;br /&gt;
 source.each do |each_element|&lt;br /&gt;
   each_element.copy(destination.id)&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# enum method for team clone operations&lt;br /&gt;
def self.team_operation&lt;br /&gt;
 { inherit: 'inherit', bequeath: 'bequeath' }.freeze&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Introduce new methods like init_team_type, get_parent_by_id, get_parent_from_child which commonly operate on fetching team type to render UI elements accordingly. The significance of each method is as follows.&lt;br /&gt;
&lt;br /&gt;
* init_team_type method. The purpose of this method is to provide team_type initialization as a common functionality to the methods in teams_controller.&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session[:team_type] = params[:type] if (params[:type] &amp;amp;&amp;amp; allowed_types.include?(params[:type]))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above line is commonly being used in multiple teams_controller.rb methods. So in order to modularize it, we have moved it to a separate method. And the if condition is no longer a one-liner because one-liner if conditions in Ruby are better suited to checking for a sole condition.&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def init_team_type(type)&lt;br /&gt;
  if type and Team.allowed_types.include?(type)&lt;br /&gt;
    session[:team_type] = type&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* get_parent_id method. The purpose of this method is to improve readability and maintainability and reduce duplication (thereby reducing the risk of error!).&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = Object.const_get(session[:team_type]).find(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_parent_by_id(id)&lt;br /&gt;
  Object.const_get(team_type).find(id)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and function call would be like&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = get_parent_by_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* get_parent_from_child method. The purpose of this method is to improve readability and maintainability and reduce duplication (thereby reducing the risk of error!).&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = Object.const_get(session[:team_type]).find(@team.parent_id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_parent_from_child(child)&lt;br /&gt;
  Object.const_get(team_type).find(child.parent_id)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and function call would be like&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = get_parent_from_child(@team)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Fix for a flaky test case due to rails environment setup configuration. Reference: https://tinyurl.com/y64bupbk.&lt;br /&gt;
Every time we run tests for teams_controller. There was a test case related to the create_teams method which is getting failed due to the below-attached code.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet causing issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    undo_link('Random teams have been successfully created.')&lt;br /&gt;
    ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Random teams have been successfully created', request)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In order to fix that we have referred to the above-attached reference and made the following code changes.&amp;lt;br&amp;gt;&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    message = 'Random teams have been successfully created'&lt;br /&gt;
    undo_link(message)&lt;br /&gt;
    # To do: Move this check to a application level commons file.&lt;br /&gt;
    # For now this is the only usage of this check.&lt;br /&gt;
    # If a similar use case pops up &amp;quot;To do&amp;quot; action needs to be performed.&lt;br /&gt;
    # Fix link: https://tinyurl.com/y64bupbk&lt;br /&gt;
    if Rails.env.development?&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, '', message, request)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Teams Model ===&lt;br /&gt;
&lt;br /&gt;
This is a model class that contains all the reusable class methods and has the necessary checks and attributes for performing checks on teams.&lt;br /&gt;
&lt;br /&gt;
==== List of changes ====&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor randomize_all_by_parent method to modify the existing logic which contains a lot of branching.&amp;lt;br&amp;gt;&lt;br /&gt;
WI2 : Refactor assign_single_users_to_teams method. Made changes to perform an early return and modified the looping logic.&amp;lt;br&amp;gt;&lt;br /&gt;
WI3 : Refactor create_team_from_single_users method. Made changes to modify the looping logic in a better way to avoid a few extra variables.&lt;br /&gt;
&lt;br /&gt;
==== Solutions Implemented and Delivered ====&lt;br /&gt;
1. Refactor randomize_all_by_parent method. The purpose of this block is to find teams that still need team members and users who are not in any team.  In Order to achieve that, we have modified the existing logic to avoid branching and achieve the same result as follows.&lt;br /&gt;
&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams_num = teams.size&lt;br /&gt;
i = 0&lt;br /&gt;
teams_num.times do&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: teams[i].id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
       users.delete(User.find(teams_user.user_id))&lt;br /&gt;
    end&lt;br /&gt;
    if Team.size(teams.first.id) &amp;gt;= min_team_size&lt;br /&gt;
       teams.delete(teams.first)&lt;br /&gt;
    else&lt;br /&gt;
       i += 1&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring the randomize_all_by_parent method in team.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams.each { |team| TeamsUser.where(team_id: team.id).each { |teams_user| users.delete(User.find(teams_user.user_id)) } }&lt;br /&gt;
teams.reject! { |team| Team.size(team.id) &amp;gt;= min_team_size }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Refactor assign_single_users_to_teams method. The purpose of this block is to fill the teams with users to meet the minimum number of students requirement. In this loop, once the users are empty we can simply return without any additional work which is being done in the existing logic. Instead of two break statements at lines 152 and 154, we can simply have one statement with “return” at line 152 to stop the function early. In summary, we can replace the existing block of code as shown below.&lt;br /&gt;
&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams.each do |team|&lt;br /&gt;
    curr_team_size = Team.size(team.id)&lt;br /&gt;
    member_num_difference = min_team_size - curr_team_size&lt;br /&gt;
    while member_num_difference &amp;gt; 0&lt;br /&gt;
        team.add_member(users.first, parent.id)&lt;br /&gt;
        users.delete(users.first)&lt;br /&gt;
        member_num_difference -= 1&lt;br /&gt;
        break if users.empty?&lt;br /&gt;
    end&lt;br /&gt;
    break if users.empty?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring the assign_single_users_to_teams method in team.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams.each do |team|&lt;br /&gt;
    curr_team_size = Team.size(team.id)&lt;br /&gt;
    member_num_difference = min_team_size - curr_team_size&lt;br /&gt;
    member_num_difference.times do&lt;br /&gt;
        team.add_member(users.first, parent.id)&lt;br /&gt;
        users.delete(users.first)&lt;br /&gt;
        return if users.empty?&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Refactor create_team_from_single_users method. This block works on adding single users who are not in any team by creating a new team for them. The block can be rewritten as below.&lt;br /&gt;
&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
min_team_size.times do&lt;br /&gt;
   break if next_team_member_index &amp;gt;= users.length&lt;br /&gt;
&lt;br /&gt;
   user = users[next_team_member_index]&lt;br /&gt;
   team.add_member(user, parent.id)&lt;br /&gt;
   next_team_member_index += 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring the team.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(0..[min_team_size, users.length].min).each do |index|&lt;br /&gt;
     user = users[index]&lt;br /&gt;
     team.add_member(user, parent.id)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Teams Views ===&lt;br /&gt;
&lt;br /&gt;
These are the views that are rendered in the frontend when the team's related web pages are loaded.&lt;br /&gt;
&lt;br /&gt;
==== List of changes ====&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Move a conditional check in list.html.erb to the list method in the controller.&amp;lt;br&amp;gt;&lt;br /&gt;
WI2 : Refactor an if-else block using ternary operator in new.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
WI3 : Refactor an if-else block using the ternary operator in _team.html.erb.&lt;br /&gt;
&lt;br /&gt;
==== Solutions Implemented and Delivered ====&lt;br /&gt;
1. Move a conditional check used in multiple places in list.html.erb to the list method in the controller, so that it can simply be used as a boolean variable in the view.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if session[:team_type] == 'Assignment'&amp;amp;&amp;amp; @assignment.max_team_size &amp;gt; 1 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We moved the condition in the if-block to the list method in the controller and use it here as a boolean variable so that the code becomes short and more readable.&amp;lt;br&amp;gt;&lt;br /&gt;
Code snippet after refactoring in list.html.erb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @is_valid_assignment %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring in teams_controller.rb list method.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@is_valid_assignment = session[:team_type] == Team.allowed_types[0] &amp;amp;&amp;amp; @assignment.max_team_size &amp;gt; 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Refactor an if-else statement using the ternary operator in new.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @parent.is_a?(Course)%&amp;gt;&lt;br /&gt;
      Team Size:&amp;lt;%= select_tag 'team_size', options_for_select(2..4), size: 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
      Team Size:&amp;lt;%= select_tag 'team_size', options_for_select(2..@parent.max_team_size), size: 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring new.html.erb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% maxsize = @parent.is_a?(Course) ? 4 : @parent.max_team_size %&amp;gt;&lt;br /&gt;
Team Size:&amp;lt;%= select_tag 'team_size', options_for_select(2..maxsize), size: 1 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Refactor an if-else statement using the ternary operator in _team.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @root_node.class == AssignmentNode %&amp;gt;&lt;br /&gt;
    &amp;lt;% modelType = ‘AssignmentTeam’ %&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;% modelType = ‘CourseTeam’ %&amp;gt;&lt;br /&gt;
&amp;lt;%end&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring _team.html.erb.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% modelType = @root_node.class == AssignmentNode ? ‘AssignmentTeam’ : ‘CourseTeam’ %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
* We have thoroughly tested all the test cases in teams_controller_spec.rb. And we have also fixed one of the flaky test cases which are mentioned above in one of the code changes. In addition to the unit tests, we have also made sure that there are no issues in the UI with the changes in the teams_controller.rb.&lt;br /&gt;
* In addition to the controller, we have also thoroughly tested the model using all the test cases in team_spec.rb. We have also verified the same in the expertiza UI.&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
'''Pre-conditions:'''&lt;br /&gt;
# You must be logged in using the [[CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller#Peer_Review_Information|previously provided credentials]].&lt;br /&gt;
# You must have a course with participants. To make a new course and add its participants, follow the instructions below.&lt;br /&gt;
## Upon login, you will see a list of courses saved to this instructor's account. &lt;br /&gt;
### If you do not see this list, hover over '''Manage...''' in the navbar.&lt;br /&gt;
### Click on '''Courses'''.&lt;br /&gt;
## To create a new course, click on the '''white and blue plus button''' to the top right of the Courses table.&lt;br /&gt;
## Select an '''institution''', enter a '''course name''', enter a '''course directory''', enter any '''course information''', select a '''default language''', and ''uncheck'' '''Private course'''.&lt;br /&gt;
## Press the '''Create''' button.&lt;br /&gt;
## You will return to the list of courses. Find the course you just created, and click the '''Add participants''' icon, which is an ''image of a person in a blue shirt with a green plus sign''.&lt;br /&gt;
## Enter the '''login name''' for a student you want to add as a participant to the course into the text field, and then press '''Add'''. Add as many students as you wish.&lt;br /&gt;
## When you are finished, click '''Back''' to return to the Course list.&lt;br /&gt;
# You must have an assignment associated with the course you made or chose to use in Pre-conditions Step #2. To make a new assignment and add its participants, follow the instructions below.&lt;br /&gt;
## Find the course in the table and click the '''Create Assignment''' button, which is an ''image of a paper with a green plus sign''.&lt;br /&gt;
## Enter an '''Assignment name''', select the '''Course''' you made or chose, enter a '''Description URL''', and ''check'' the '''Has teams?''' checkbox.&lt;br /&gt;
## Click the '''Create''' button.&lt;br /&gt;
## Click the '''Save''' button.&lt;br /&gt;
## Click the link in the red flash message to ''add participants to the new assignment''.&lt;br /&gt;
### If you don't see that flash message, you may hover over '''Manage...''' in the navbar and then select '''Assignments'''.&lt;br /&gt;
### Locate the assignment in the table and click the '''Add participants''' icon which is an ''image of a person in a blue shirt with a green plus sign''.&lt;br /&gt;
## Click the link that says '''Copy participants from course'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create Randomly-Chosen Teams:'''&lt;br /&gt;
# Navigate to the Courses table, and locate the course you made or chose previously.&lt;br /&gt;
# Click the '''Create teams''' icon, which is an ''image of three people with a green plus sign''.&lt;br /&gt;
# This is the ''Course Teams table''.&lt;br /&gt;
# Click the '''Create Team''' link.&lt;br /&gt;
# Keep the default value of ''2'' in the '''Team Size''' select, and press '''Create Teams'''.&lt;br /&gt;
# You should see some new teams populated in the Course Teams table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Delete Individual Teams:'''&lt;br /&gt;
# Navigate to the Course Teams table.&lt;br /&gt;
# Click on any ''red X'' next to a team name to '''delete''' that team.&lt;br /&gt;
# The page should refresh and show that the deleted team no longer exists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Delete All Teams:'''&lt;br /&gt;
# Navigate to the Course Teams table.&lt;br /&gt;
# Click the '''Delete All Teams''' link to delete all teams associated with the course.&lt;br /&gt;
# The page should refresh and show that there are no more teams associated with the course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Manually Create a Team:'''&lt;br /&gt;
# Navigate to the Course Teams table.&lt;br /&gt;
# Click the '''Create Team''' link.&lt;br /&gt;
# Enter a '''Team Name'' into the text field and press '''Save'''.&lt;br /&gt;
# The Course Teams table should be shown with the new team present.&lt;br /&gt;
# Click the ''green plus button'' to '''Add Team Member'''.&lt;br /&gt;
# Enter the '''login name''' for a student you want to add to the team, and press '''Add'''.&lt;br /&gt;
# You can confirm this addition but pressing the ''black and white plus button'' to the left of the team's table entry. The student should be shown as a team member.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Inherit Teams:'''&lt;br /&gt;
# Ensure your course has at least one team.&lt;br /&gt;
# Navigate to the assignment you chose or created previously.&lt;br /&gt;
# Click the '''Create teams''' icon, which is an ''image of three people with a green plus sign''.&lt;br /&gt;
# This is the ''Assignment Teams table''.&lt;br /&gt;
# If the assignment already has teams, delete them.&lt;br /&gt;
# Click the '''Create Team''' link.&lt;br /&gt;
# Press the '''Inherit''' button.&lt;br /&gt;
# You should now see the teams from the course displayed in the Assignment Teams table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bequeath All Teams:'''&lt;br /&gt;
# Ensure your course has no teams.&lt;br /&gt;
# Navigate to the assignment you chose or created previously.&lt;br /&gt;
# Ensure your assignment has at least one team.&lt;br /&gt;
# Click '''Bequeath All Teams'''.&lt;br /&gt;
# Navigate to your course's Course Teams table.&lt;br /&gt;
# You should now see the teams from the assignment displayed in the Course Teams table.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
1. The construct_table method in GradesHelper is not used anywhere. It has no reference in the project. So we feel it can be safely removed.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. The has_team_and_metareview? method in GradesHelper can be broken down into separate methods, one each for team and metareview. This will provide improved flexibility. It needs some analysis though, as both the entities(team &amp;amp; metareview) are currently checked in conjunction from all the views they are referenced from.&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller&amp;diff=143085</id>
		<title>CSC/ECE 517 Spring 2022 - E2214: Refactor teams controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller&amp;diff=143085"/>
		<updated>2022-03-20T22:34:21Z</updated>

		<summary type="html">&lt;p&gt;Kflemin3: detailed description of how to perform UI testing of important features affected by this refactor&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki page is for the description of changes made under E2214 OSS assignment for Spring 2022, CSC/ECE 517.&lt;br /&gt;
&lt;br /&gt;
== Peer Review Information ==&lt;br /&gt;
&lt;br /&gt;
For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:&lt;br /&gt;
&lt;br /&gt;
Instructor Login: username -&amp;gt; instructor6,  password -&amp;gt; password&lt;br /&gt;
&lt;br /&gt;
== Expertiza Background==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open-source project developed on the Ruby on Rails platform and its code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.&lt;br /&gt;
&lt;br /&gt;
== Description of the current project ==&lt;br /&gt;
&lt;br /&gt;
The following is an Expertiza based OSS project which deals primarily with the models, views, and controllers of Teams. Core to any online learning platform is the ability of students and instructors to create and delete teams. Teams_Controller primarily handles the creation, deletion, and other behaviors of course teams and assignment teams. Most of its methods are called from the instructor’s point of view in expertiza. This controller has some problems that violate some essential Rails design principles. There are a few methods in this controller that should have been in model classes. Some methods share code, which creates code repetition. Our project primarily focuses on refactoring some complex methods that involve high branching, removing redundant and dead code, modularising common functionalities, and condensing the existing bad code into a few lines to achieve the same functionality. The goal of this project is to attempt to make this part of the application easier to read and maintain.&lt;br /&gt;
&lt;br /&gt;
== Files modified in current project ==&lt;br /&gt;
&lt;br /&gt;
Controller, model and views were modified for this project namely:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Teams Controller: teams_controller.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Teams Model: team.rb &amp;lt;br/&amp;gt;&lt;br /&gt;
3. Teams Views&lt;br /&gt;
* list.html.erb&lt;br /&gt;
* new.html.erb&lt;br /&gt;
* _team.html.erb&lt;br /&gt;
4. (Generic)Tree Display Views&lt;br /&gt;
* _page_footer.html.erb&lt;br /&gt;
* _entry_html.erb&lt;br /&gt;
* _folder.html.erb&lt;br /&gt;
* _listing.html.erb&lt;br /&gt;
&lt;br /&gt;
=== Teams Controller ===&lt;br /&gt;
&lt;br /&gt;
The controller contains all the methods to perform CRUD operations on the teams when seen from the instructor's point of view in the UI.&lt;br /&gt;
&lt;br /&gt;
==== List of changes ====&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Move allowed types list constant in list method to model as it is a best practice to keep all the constants at one place.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI2 : Refactor delete method. This method deletes the team and erases the records from teams_users and signed_up_teams table.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI3 : Refactor inherit and bequeath_all methods. Both the methods contain duplicated code with nested branching statements.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI4 : Introduce new methods like init_team_type, get_parent_by_id, get_parent_from_child which commonly operate on fetching team type to render UI elements accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
WI5 : Fix for a flaky test case on creating teams with the random members method.&lt;br /&gt;
&lt;br /&gt;
==== Solutions Implemented and Delivered ====&lt;br /&gt;
 &lt;br /&gt;
1. Refactoring in the list method.&lt;br /&gt;
The list method contains a list of constants to check if the team_type from the session variables is a valid one or not. &lt;br /&gt;
&lt;br /&gt;
Existing code snippet in teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
allowed_types = %w[Assignment Course]&lt;br /&gt;
session[:team_type] = params[:type] if params[:type] &amp;amp;&amp;amp; allowed_types.include?(params[:type])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have moved the constant allowed_types to the teams model so that it can be used wherever needed in the teams_controller.rb.&amp;lt;br&amp;gt;&lt;br /&gt;
Code snippet after refactoring in team.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Allowed types of teams -- ASSIGNMENT teams or COURSE teams&lt;br /&gt;
def self.allowed_types&lt;br /&gt;
  # non-interpolated array of single-quoted strings&lt;br /&gt;
  %w[Assignment Course]&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring showing the usage in teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session[:team_type] = params[:type] if params[:type] &amp;amp;&amp;amp; Team.allowed_types.include?(params[:type])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Refactor delete method.&lt;br /&gt;
This method contains an if block in which the condition is never satisfied. It is considered a dead code. Related piazza post: https://piazza.com/class/kxwmkrv8djq573?cid=210&lt;br /&gt;
&lt;br /&gt;
So we have simply removed that if block. Below is the removed code snippet.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if @signed_up_team == 1 &amp;amp;&amp;amp; !@signUps.first.is_waitlisted # this team hold a topic&lt;br /&gt;
   # if there is another team in waitlist, make this team hold this topic&lt;br /&gt;
   topic_id = @signed_up_team.first.topic_id&lt;br /&gt;
   next_wait_listed_team = SignedUpTeam.where(topic_id: topic_id, is_waitlisted: true).first&lt;br /&gt;
   # if slot exist, then confirm the topic for this team and delete all waitlists for this team&lt;br /&gt;
   SignUpTopic.assign_to_first_waiting_team(next_wait_listed_team) if next_wait_listed_team&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And also there is a statement at line 89 which we replaced with &amp;lt;pre&amp;gt;@team.destroy&amp;lt;/pre&amp;gt; instead of &amp;lt;pre&amp;gt;@team.destroy if @team&amp;lt;/pre&amp;gt; because we already have a nil check for this variable in line 74, so we can remove the redundant ones.&lt;br /&gt;
&lt;br /&gt;
3. Refactor inherit and bequeath_all methods.&lt;br /&gt;
Both methods contain a piece of code in common. They also have high branching in them which makes the code readability much more difficult.&lt;br /&gt;
Existing Code Snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copies existing teams from a course down to an assignment&lt;br /&gt;
# The team and team members are all copied.&lt;br /&gt;
def inherit&lt;br /&gt;
 assignment = Assignment.find(params[:id])&lt;br /&gt;
 if assignment.course_id&lt;br /&gt;
   course = Course.find(assignment.course_id)&lt;br /&gt;
   teams = course.get_teams&lt;br /&gt;
   if teams.empty?&lt;br /&gt;
     flash[:note] = 'No teams were found when trying to inherit.'&lt;br /&gt;
   else&lt;br /&gt;
     teams.each do |team|&lt;br /&gt;
       team.copy(assignment.id)&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 else&lt;br /&gt;
   flash[:error] = 'No course was found for this assignment.'&lt;br /&gt;
 end&lt;br /&gt;
 redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def bequeath_all&lt;br /&gt;
 if session[:team_type] == 'Course'&lt;br /&gt;
   flash[:error] = 'Invalid team type for bequeathal'&lt;br /&gt;
   redirect_to controller: 'teams', action: 'list', id: params[:id]&lt;br /&gt;
   return&lt;br /&gt;
 end&lt;br /&gt;
 assignment = Assignment.find(params[:id])&lt;br /&gt;
 if assignment.course_id&lt;br /&gt;
   course = Course.find(assignment.course_id)&lt;br /&gt;
   if course.course_teams.any?&lt;br /&gt;
     flash[:error] = 'The course already has associated teams'&lt;br /&gt;
     redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
     return&lt;br /&gt;
   end&lt;br /&gt;
   teams = assignment.teams&lt;br /&gt;
   teams.each do |team|&lt;br /&gt;
     team.copy(course.id)&lt;br /&gt;
   end&lt;br /&gt;
   flash[:note] = teams.length.to_s + ' teams were successfully copied to &amp;quot;' + course.name + '&amp;quot;'&lt;br /&gt;
 else&lt;br /&gt;
   flash[:error] = 'No course was found for this assignment.'&lt;br /&gt;
 end&lt;br /&gt;
 redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a solution for this problem, we have separated the bigger functions and broken them into smaller ones as below.&lt;br /&gt;
Code snippet after refactoring in teams_controller.rb.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Copies existing teams from a course down to an assignment&lt;br /&gt;
# The team and team members are all copied.&lt;br /&gt;
def inherit&lt;br /&gt;
 copy_teams(Team.team_operation[:inherit])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Handovers all teams to the course that contains the corresponding assignment&lt;br /&gt;
# The team and team members are all copied.&lt;br /&gt;
def bequeath_all&lt;br /&gt;
 if session[:team_type] == 'Course'&lt;br /&gt;
   flash[:error] = 'Invalid team type for bequeath all'&lt;br /&gt;
   redirect_to controller: 'teams', action: 'list', id: params[:id]&lt;br /&gt;
 else&lt;br /&gt;
   copy_teams(Team.team_operation[:bequeath])&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
private&lt;br /&gt;
&lt;br /&gt;
# Method to abstract the functionality to copy teams.&lt;br /&gt;
def copy_teams(operation)&lt;br /&gt;
 assignment = Assignment.find(params[:id])&lt;br /&gt;
 if assignment.course_id&lt;br /&gt;
   choose_copy_type(assignment, operation)&lt;br /&gt;
 else&lt;br /&gt;
   flash[:error] = 'No course was found for this assignment.'&lt;br /&gt;
 end&lt;br /&gt;
 redirect_to controller: 'teams', action: 'list', id: assignment.id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Method to choose copy technique based on the operation type.&lt;br /&gt;
def choose_copy_type(assignment, operation)&lt;br /&gt;
 course = Course.find(assignment.course_id)&lt;br /&gt;
 if operation == Team.team_operation[:bequeath]&lt;br /&gt;
   bequeath_copy(assignment, course)&lt;br /&gt;
 else&lt;br /&gt;
   inherit_copy(assignment, course)&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Method to perform a copy of assignment teams to course&lt;br /&gt;
def bequeath_copy(assignment, course)&lt;br /&gt;
 teams = assignment.teams&lt;br /&gt;
 if course.course_teams.any?&lt;br /&gt;
   flash[:error] = 'The course already has associated teams'&lt;br /&gt;
 else&lt;br /&gt;
   Team.copy_content(teams, course)&lt;br /&gt;
   flash[:note] = teams.length.to_s + ' teams were successfully copied to &amp;quot;' + course.name + '&amp;quot;'&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Method to inherit teams from course by copying&lt;br /&gt;
def inherit_copy(assignment, course)&lt;br /&gt;
 teams = course.course_teams&lt;br /&gt;
 if teams.empty?&lt;br /&gt;
   flash[:error] = 'No teams were found when trying to inherit.'&lt;br /&gt;
 else&lt;br /&gt;
   Team.copy_content(teams, assignment)&lt;br /&gt;
   flash[:note] = teams.length.to_s + ' teams were successfully copied to &amp;quot;' + assignment.name + '&amp;quot;'&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring in team.rb.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# copies content of one object to the another&lt;br /&gt;
def self.copy_content(source, destination)&lt;br /&gt;
 source.each do |each_element|&lt;br /&gt;
   each_element.copy(destination.id)&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# enum method for team clone operations&lt;br /&gt;
def self.team_operation&lt;br /&gt;
 { inherit: 'inherit', bequeath: 'bequeath' }.freeze&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Introduce new methods like init_team_type, get_parent_by_id, get_parent_from_child which commonly operate on fetching team type to render UI elements accordingly. The significance of each method is as follows.&lt;br /&gt;
&lt;br /&gt;
* init_team_type method. The purpose of this method is to provide team_type initialization as a common functionality to the methods in teams_controller.&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
session[:team_type] = params[:type] if (params[:type] &amp;amp;&amp;amp; allowed_types.include?(params[:type]))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The above line is commonly being used in multiple teams_controller.rb methods. So in order to modularize it, we have moved it to a separate method. And the if condition is no longer a one-liner because one-liner if conditions in Ruby are better suited to checking for a sole condition.&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def init_team_type(type)&lt;br /&gt;
  if type and Team.allowed_types.include?(type)&lt;br /&gt;
    session[:team_type] = type&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* get_parent_id method. The purpose of this method is to improve readability and maintainability and reduce duplication (thereby reducing the risk of error!).&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = Object.const_get(session[:team_type]).find(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_parent_by_id(id)&lt;br /&gt;
  Object.const_get(team_type).find(id)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and function call would be like&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = get_parent_by_id(params[:id])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* get_parent_from_child method. The purpose of this method is to improve readability and maintainability and reduce duplication (thereby reducing the risk of error!).&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = Object.const_get(session[:team_type]).find(@team.parent_id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_parent_from_child(child)&lt;br /&gt;
  Object.const_get(team_type).find(child.parent_id)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and function call would be like&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
parent = get_parent_from_child(@team)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Fix for a flaky test case due to rails environment setup configuration. Reference: https://tinyurl.com/y64bupbk.&lt;br /&gt;
Every time we run tests for teams_controller. There was a test case related to the create_teams method which is getting failed due to the below-attached code.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet causing issue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    undo_link('Random teams have been successfully created.')&lt;br /&gt;
    ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Random teams have been successfully created', request)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In order to fix that we have referred to the above-attached reference and made the following code changes.&amp;lt;br&amp;gt;&lt;br /&gt;
Code snippet after refactoring the teams_controller.rb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    message = 'Random teams have been successfully created'&lt;br /&gt;
    undo_link(message)&lt;br /&gt;
    # To do: Move this check to a application level commons file.&lt;br /&gt;
    # For now this is the only usage of this check.&lt;br /&gt;
    # If a similar use case pops up &amp;quot;To do&amp;quot; action needs to be performed.&lt;br /&gt;
    # Fix link: https://tinyurl.com/y64bupbk&lt;br /&gt;
    if Rails.env.development?&lt;br /&gt;
      ExpertizaLogger.info LoggerMessage.new(controller_name, '', message, request)&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Teams Model ===&lt;br /&gt;
&lt;br /&gt;
This is a model class that contains all the reusable class methods and has the necessary checks and attributes for performing checks on teams.&lt;br /&gt;
&lt;br /&gt;
==== List of changes ====&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Refactor randomize_all_by_parent method to modify the existing logic which contains a lot of branching.&amp;lt;br&amp;gt;&lt;br /&gt;
WI2 : Refactor assign_single_users_to_teams method. Made changes to perform an early return and modified the looping logic.&amp;lt;br&amp;gt;&lt;br /&gt;
WI3 : Refactor create_team_from_single_users method. Made changes to modify the looping logic in a better way to avoid a few extra variables.&lt;br /&gt;
&lt;br /&gt;
==== Solutions Implemented and Delivered ====&lt;br /&gt;
1. Refactor randomize_all_by_parent method. The purpose of this block is to find teams that still need team members and users who are not in any team.  In Order to achieve that, we have modified the existing logic to avoid branching and achieve the same result as follows.&lt;br /&gt;
&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams_num = teams.size&lt;br /&gt;
i = 0&lt;br /&gt;
teams_num.times do&lt;br /&gt;
    teams_users = TeamsUser.where(team_id: teams[i].id)&lt;br /&gt;
    teams_users.each do |teams_user|&lt;br /&gt;
       users.delete(User.find(teams_user.user_id))&lt;br /&gt;
    end&lt;br /&gt;
    if Team.size(teams.first.id) &amp;gt;= min_team_size&lt;br /&gt;
       teams.delete(teams.first)&lt;br /&gt;
    else&lt;br /&gt;
       i += 1&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring the randomize_all_by_parent method in team.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams.each { |team| TeamsUser.where(team_id: team.id).each { |teams_user| users.delete(User.find(teams_user.user_id)) } }&lt;br /&gt;
teams.reject! { |team| Team.size(team.id) &amp;gt;= min_team_size }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Refactor assign_single_users_to_teams method. The purpose of this block is to fill the teams with users to meet the minimum number of students requirement. In this loop, once the users are empty we can simply return without any additional work which is being done in the existing logic. Instead of two break statements at lines 152 and 154, we can simply have one statement with “return” at line 152 to stop the function early. In summary, we can replace the existing block of code as shown below.&lt;br /&gt;
&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams.each do |team|&lt;br /&gt;
    curr_team_size = Team.size(team.id)&lt;br /&gt;
    member_num_difference = min_team_size - curr_team_size&lt;br /&gt;
    while member_num_difference &amp;gt; 0&lt;br /&gt;
        team.add_member(users.first, parent.id)&lt;br /&gt;
        users.delete(users.first)&lt;br /&gt;
        member_num_difference -= 1&lt;br /&gt;
        break if users.empty?&lt;br /&gt;
    end&lt;br /&gt;
    break if users.empty?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring the assign_single_users_to_teams method in team.rb file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
teams.each do |team|&lt;br /&gt;
    curr_team_size = Team.size(team.id)&lt;br /&gt;
    member_num_difference = min_team_size - curr_team_size&lt;br /&gt;
    member_num_difference.times do&lt;br /&gt;
        team.add_member(users.first, parent.id)&lt;br /&gt;
        users.delete(users.first)&lt;br /&gt;
        return if users.empty?&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Refactor create_team_from_single_users method. This block works on adding single users who are not in any team by creating a new team for them. The block can be rewritten as below.&lt;br /&gt;
&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
min_team_size.times do&lt;br /&gt;
   break if next_team_member_index &amp;gt;= users.length&lt;br /&gt;
&lt;br /&gt;
   user = users[next_team_member_index]&lt;br /&gt;
   team.add_member(user, parent.id)&lt;br /&gt;
   next_team_member_index += 1&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring the team.rb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(0..[min_team_size, users.length].min).each do |index|&lt;br /&gt;
     user = users[index]&lt;br /&gt;
     team.add_member(user, parent.id)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Teams Views ===&lt;br /&gt;
&lt;br /&gt;
These are the views that are rendered in the frontend when the team's related web pages are loaded.&lt;br /&gt;
&lt;br /&gt;
==== List of changes ====&lt;br /&gt;
We worked on the following work items(WIs)&amp;lt;br/&amp;gt;&lt;br /&gt;
WI1 : Move a conditional check in list.html.erb to the list method in the controller.&amp;lt;br&amp;gt;&lt;br /&gt;
WI2 : Refactor an if-else block using ternary operator in new.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
WI3 : Refactor an if-else block using the ternary operator in _team.html.erb.&lt;br /&gt;
&lt;br /&gt;
==== Solutions Implemented and Delivered ====&lt;br /&gt;
1. Move a conditional check used in multiple places in list.html.erb to the list method in the controller, so that it can simply be used as a boolean variable in the view.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if session[:team_type] == 'Assignment'&amp;amp;&amp;amp; @assignment.max_team_size &amp;gt; 1 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
We moved the condition in the if-block to the list method in the controller and use it here as a boolean variable so that the code becomes short and more readable.&amp;lt;br&amp;gt;&lt;br /&gt;
Code snippet after refactoring in list.html.erb&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @is_valid_assignment %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet after refactoring in teams_controller.rb list method.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@is_valid_assignment = session[:team_type] == Team.allowed_types[0] &amp;amp;&amp;amp; @assignment.max_team_size &amp;gt; 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Refactor an if-else statement using the ternary operator in new.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @parent.is_a?(Course)%&amp;gt;&lt;br /&gt;
      Team Size:&amp;lt;%= select_tag 'team_size', options_for_select(2..4), size: 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
      Team Size:&amp;lt;%= select_tag 'team_size', options_for_select(2..@parent.max_team_size), size: 1 %&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring new.html.erb:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% maxsize = @parent.is_a?(Course) ? 4 : @parent.max_team_size %&amp;gt;&lt;br /&gt;
Team Size:&amp;lt;%= select_tag 'team_size', options_for_select(2..maxsize), size: 1 %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Refactor an if-else statement using the ternary operator in _team.html.erb.&amp;lt;br&amp;gt;&lt;br /&gt;
Existing code snippet:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @root_node.class == AssignmentNode %&amp;gt;&lt;br /&gt;
    &amp;lt;% modelType = ‘AssignmentTeam’ %&amp;gt;&lt;br /&gt;
&amp;lt;% else %&amp;gt;&lt;br /&gt;
    &amp;lt;% modelType = ‘CourseTeam’ %&amp;gt;&lt;br /&gt;
&amp;lt;%end&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Code snippet after refactoring _team.html.erb.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% modelType = @root_node.class == AssignmentNode ? ‘AssignmentTeam’ : ‘CourseTeam’ %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing Details==&lt;br /&gt;
&lt;br /&gt;
=== RSpec ===&lt;br /&gt;
* We have thoroughly tested all the test cases in teams_controller_spec.rb. And we have also fixed one of the flaky test cases which are mentioned above in one of the code changes. In addition to the unit tests, we have also made sure that there are no issues in the UI with the changes in the teams_controller.rb.&lt;br /&gt;
* In addition to the controller, we have also thoroughly tested the model using all the test cases in team_spec.rb. We have also verified the same in the expertiza UI.&lt;br /&gt;
&lt;br /&gt;
=== UI Testing ===&lt;br /&gt;
&lt;br /&gt;
'''Pre-conditions:'''&lt;br /&gt;
# You must be logged in using the [[CSC/ECE_517_Spring_2022_-_E2214:_Refactor_teams_controller#Peer_Review_Information|previously provided credentials]].&lt;br /&gt;
# You must have a course with participants. To make a new course and add its participants, follow the instructions below.&lt;br /&gt;
## Upon login, you will see a list of courses saved to this instructor's account. &lt;br /&gt;
### If you do not see this list, hover over '''Manage...''' in the navbar.&lt;br /&gt;
### Click on '''Courses'''.&lt;br /&gt;
## To create a new course, click on the '''white and blue plus button''' to the top right of the Courses table.&lt;br /&gt;
## Select an '''institution''', enter a '''course name''', enter a '''course directory''', enter any '''course information''', select a '''default language''', and ''uncheck'' '''Private course'''.&lt;br /&gt;
## Press the '''Create''' button.&lt;br /&gt;
## You will return to the list of courses. Find the course you just created, and click the '''Add participants''' icon, which is an ''image of a person in a blue shirt with a green plus sign''.&lt;br /&gt;
## Enter the '''login name''' for a student you want to add as a participant to the course into the text field, and then press '''Add'''. Add as many students as you wish.&lt;br /&gt;
## When you are finished, click '''Back''' to return to the Course list.&lt;br /&gt;
# You must have an assignment associated with the course you made or chose to use in Pre-conditions Step #2. To make a new assignment and add its participants, follow the instructions below.&lt;br /&gt;
## Find the course in the table and click the '''Create Assignment''' button, which is an ''image of a paper with a green plus sign''.&lt;br /&gt;
## Enter an '''Assignment name''', select the '''Course''' you made or chose, enter a '''Description URL''', and ''check'' the '''Has teams?''' checkbox.&lt;br /&gt;
## Click the '''Create''' button.&lt;br /&gt;
## Click the '''Save''' button.&lt;br /&gt;
## Click the link in the red flash message to ''add participants to the new assignment''.&lt;br /&gt;
### If you don't see that flash message, you may hover over '''Manage...''' in the navbar and then select '''Assignments'''.&lt;br /&gt;
### Locate the assignment in the table and click the '''Add participants''' icon which is an ''image of a person in a blue shirt with a green plus sign''.&lt;br /&gt;
## Click the link that says '''Copy participants from course'''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create Randomly-Chosen Teams:'''&lt;br /&gt;
# Navigate to the Courses table, and locate the course you made or chose previously.&lt;br /&gt;
# Click the '''Create teams''' icon, which is an ''image of three people with a green plus sign''.&lt;br /&gt;
# This is the ''Course Teams table''.&lt;br /&gt;
# Click the '''Create Team''' link.&lt;br /&gt;
# Keep the default value of ''2'' in the '''Team Size''' select, and press '''Create Teams'''.&lt;br /&gt;
# You should see some new teams populated in the Course Teams table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Delete Individual Teams:'''&lt;br /&gt;
# Navigate to the Course Teams table.&lt;br /&gt;
# Click on any ''red X'' next to a team name to '''delete''' that team.&lt;br /&gt;
# The page should refresh and show that the deleted team no longer exists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Delete All Teams:'''&lt;br /&gt;
# Navigate to the Course Teams table.&lt;br /&gt;
# Click the '''Delete All Teams''' link to delete all teams associated with the course.&lt;br /&gt;
# The page should refresh and show that there are no more teams associated with the course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Manually Create a Team:'''&lt;br /&gt;
# Navigate to the Course Teams table.&lt;br /&gt;
# Click the '''Create Team''' link.&lt;br /&gt;
# Enter a '''Team Name'' into the text field and press '''Save'''.&lt;br /&gt;
# The Course Teams table should be shown with the new team present.&lt;br /&gt;
# Click the ''green plus button'' to '''Add Team Member'''.&lt;br /&gt;
# Enter the '''login name''' for a student you want to add to the team, and press '''Add'''.&lt;br /&gt;
# You can confirm this addition but pressing the ''black and white plus button'' to the left of the team's table entry. The student should be shown as a team member.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Inherit Teams:'''&lt;br /&gt;
# Ensure your course has at least one team.&lt;br /&gt;
# Navigate to the assignment you chose or created previously.&lt;br /&gt;
# Click the '''Create teams''' icon, which is an ''image of three people with a green plus sign''.&lt;br /&gt;
# This is the ''Assignment Teams table''.&lt;br /&gt;
# If the assignment already has teams, delete them.&lt;br /&gt;
# Click the '''Create Team''' link.&lt;br /&gt;
# Press the '''Inherit''' button.&lt;br /&gt;
# You should now see the teams from the course displayed in the Assignment Teams table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Bequeath All Teams:'''&lt;br /&gt;
# Ensure your course has no teams.&lt;br /&gt;
# Navigate to the assignment you chose or created previously.&lt;br /&gt;
# Ensure your assignment has at least one team.&lt;br /&gt;
# Click '''Bequeath All Teams'''.&lt;br /&gt;
# Navigate to your course's Course Teams table.&lt;br /&gt;
# You should now see the teams from the assignment displayed in the Course Teams table.&lt;br /&gt;
&lt;br /&gt;
== Scope for future improvement ==&lt;br /&gt;
1. The construct_table method in GradesHelper is not used anywhere. It has no reference in the project. So we feel it can be safely removed.&amp;lt;br/&amp;gt;&lt;br /&gt;
2. The has_team_and_metareview? method in GradesHelper can be broken down into separate methods, one each for team and metareview. This will provide improved flexibility. It needs some analysis though, as both the entities(team &amp;amp; metareview) are currently checked in conjuction from all the views they are referenced from.&lt;/div&gt;</summary>
		<author><name>Kflemin3</name></author>
	</entry>
</feed>