<?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=Smaraba</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=Smaraba"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Smaraba"/>
	<updated>2026-05-27T07:35:28Z</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_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150212</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150212"/>
		<updated>2023-04-26T01:55:51Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
* late_policy_features_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To test for flash error message on new late policy page, we have written this test. It creates a new copy of the old_assignment with a different name, directory_path, and copy_flag attributes. The test ensures that the new_assignment_id is not nil, which indicates that a new copy of the old_assignment was created successfully. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Test for flash error message on new late policy page&lt;br /&gt;
  it 'Flash Error Message on New Late Policy Page', js: true do&lt;br /&gt;
    assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
    create(:topic, assignment_id: assignment.id)&lt;br /&gt;
    visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
    click_link 'Due Dates'&lt;br /&gt;
    click_link 'New Late Policy'&lt;br /&gt;
    fails if&lt;br /&gt;
      expect(flash[:error]).to be('Failed to save the assignment: ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test for back button interaction on new late policy page, this test has been written. It verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment. The test uses expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &lt;br /&gt;
it 'Back Button Interation on New Late Policy Page', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This test was written for back button interaction on new late policy page while creating. This test verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment while creating a late policy. The test uses RSpec's expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'Back Button Interation on New Late Policy Page while creating', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  fill_in &amp;quot;policy_name&amp;quot;, with: 'Test Late Policy'&lt;br /&gt;
  fill_in &amp;quot;penalty_per_unit&amp;quot;, with: '15'&lt;br /&gt;
  fill_in &amp;quot;max_penalty&amp;quot;, with: '20'&lt;br /&gt;
  click_button 'Create'&lt;br /&gt;
  visit &amp;quot;/late_policies&amp;quot;&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
When logging in as an instructor, use the following credentials:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username: administrator_star&lt;br /&gt;
password: password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please follow these steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150211</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150211"/>
		<updated>2023-04-26T01:55:33Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
* late_policy_features_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To test for flash error message on new late policy page, we have written this test. It creates a new copy of the old_assignment with a different name, directory_path, and copy_flag attributes. The test ensures that the new_assignment_id is not nil, which indicates that a new copy of the old_assignment was created successfully. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Test for flash error message on new late policy page&lt;br /&gt;
  it 'Flash Error Message on New Late Policy Page', js: true do&lt;br /&gt;
    assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
    create(:topic, assignment_id: assignment.id)&lt;br /&gt;
    visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
    click_link 'Due Dates'&lt;br /&gt;
    click_link 'New Late Policy'&lt;br /&gt;
    fails if&lt;br /&gt;
      expect(flash[:error]).to be('Failed to save the assignment: ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test for back button interaction on new late policy page, this test has been written. It verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment. The test uses expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &lt;br /&gt;
it 'Back Button Interation on New Late Policy Page', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This test was written for back button interaction on new late policy page while creating. This test verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment while creating a late policy. The test uses RSpec's expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'Back Button Interation on New Late Policy Page while creating', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  fill_in &amp;quot;policy_name&amp;quot;, with: 'Test Late Policy'&lt;br /&gt;
  fill_in &amp;quot;penalty_per_unit&amp;quot;, with: '15'&lt;br /&gt;
  fill_in &amp;quot;max_penalty&amp;quot;, with: '20'&lt;br /&gt;
  click_button 'Create'&lt;br /&gt;
  visit &amp;quot;/late_policies&amp;quot;&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
When logging in as an instructor, use the following credentials:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
username: administrator_star&amp;lt;br&amp;gt; password: password&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Please follow these steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150210</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150210"/>
		<updated>2023-04-26T01:55:04Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
* late_policy_features_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To test for flash error message on new late policy page, we have written this test. It creates a new copy of the old_assignment with a different name, directory_path, and copy_flag attributes. The test ensures that the new_assignment_id is not nil, which indicates that a new copy of the old_assignment was created successfully. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Test for flash error message on new late policy page&lt;br /&gt;
  it 'Flash Error Message on New Late Policy Page', js: true do&lt;br /&gt;
    assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
    create(:topic, assignment_id: assignment.id)&lt;br /&gt;
    visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
    click_link 'Due Dates'&lt;br /&gt;
    click_link 'New Late Policy'&lt;br /&gt;
    fails if&lt;br /&gt;
      expect(flash[:error]).to be('Failed to save the assignment: ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test for back button interaction on new late policy page, this test has been written. It verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment. The test uses expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &lt;br /&gt;
it 'Back Button Interation on New Late Policy Page', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This test was written for back button interaction on new late policy page while creating. This test verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment while creating a late policy. The test uses RSpec's expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'Back Button Interation on New Late Policy Page while creating', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  fill_in &amp;quot;policy_name&amp;quot;, with: 'Test Late Policy'&lt;br /&gt;
  fill_in &amp;quot;penalty_per_unit&amp;quot;, with: '15'&lt;br /&gt;
  fill_in &amp;quot;max_penalty&amp;quot;, with: '20'&lt;br /&gt;
  click_button 'Create'&lt;br /&gt;
  visit &amp;quot;/late_policies&amp;quot;&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
When logging in as an instructor, use the following credentials:&amp;lt;br&amp;gt;&lt;br /&gt;
username: administrator_star&amp;lt;br&amp;gt; password: password&amp;lt;br&amp;gt;&lt;br /&gt;
Please follow these steps: &amp;lt;br&amp;gt;&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150209</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150209"/>
		<updated>2023-04-26T01:52:01Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Files Refactored or Modified */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
* late_policy_features_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To test for flash error message on new late policy page, we have written this test. It creates a new copy of the old_assignment with a different name, directory_path, and copy_flag attributes. The test ensures that the new_assignment_id is not nil, which indicates that a new copy of the old_assignment was created successfully. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Test for flash error message on new late policy page&lt;br /&gt;
  it 'Flash Error Message on New Late Policy Page', js: true do&lt;br /&gt;
    assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
    create(:topic, assignment_id: assignment.id)&lt;br /&gt;
    visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
    click_link 'Due Dates'&lt;br /&gt;
    click_link 'New Late Policy'&lt;br /&gt;
    fails if&lt;br /&gt;
      expect(flash[:error]).to be('Failed to save the assignment: ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test for back button interaction on new late policy page, this test has been written. It verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment. The test uses expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &lt;br /&gt;
it 'Back Button Interation on New Late Policy Page', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This test was written for back button interaction on new late policy page while creating. This test verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment while creating a late policy. The test uses RSpec's expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'Back Button Interation on New Late Policy Page while creating', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  fill_in &amp;quot;policy_name&amp;quot;, with: 'Test Late Policy'&lt;br /&gt;
  fill_in &amp;quot;penalty_per_unit&amp;quot;, with: '15'&lt;br /&gt;
  fill_in &amp;quot;max_penalty&amp;quot;, with: '20'&lt;br /&gt;
  click_button 'Create'&lt;br /&gt;
  visit &amp;quot;/late_policies&amp;quot;&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150207</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150207"/>
		<updated>2023-04-26T01:50:44Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To test for flash error message on new late policy page, we have written this test. It creates a new copy of the old_assignment with a different name, directory_path, and copy_flag attributes. The test ensures that the new_assignment_id is not nil, which indicates that a new copy of the old_assignment was created successfully. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Test for flash error message on new late policy page&lt;br /&gt;
  it 'Flash Error Message on New Late Policy Page', js: true do&lt;br /&gt;
    assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
    create(:topic, assignment_id: assignment.id)&lt;br /&gt;
    visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
    click_link 'Due Dates'&lt;br /&gt;
    click_link 'New Late Policy'&lt;br /&gt;
    fails if&lt;br /&gt;
      expect(flash[:error]).to be('Failed to save the assignment: ')&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test for back button interaction on new late policy page, this test has been written. It verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment. The test uses expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &lt;br /&gt;
it 'Back Button Interation on New Late Policy Page', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This test was written for back button interaction on new late policy page while creating. This test verifies that the &amp;quot;Back&amp;quot; button on the new late policy page correctly takes the user back to the edit page of the Assignment while creating a late policy. The test uses RSpec's expect method to assert that the page is routed to the correct URL after clicking the &amp;quot;Back&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
it 'Back Button Interation on New Late Policy Page while creating', js: true do&lt;br /&gt;
  assignment = Assignment.where(name: 'assignment for late policy test').first&lt;br /&gt;
  create(:topic, assignment_id: assignment.id)&lt;br /&gt;
  visit &amp;quot;/assignments/#{assignment.id}/edit&amp;quot;&lt;br /&gt;
  click_link 'Due Dates'&lt;br /&gt;
  click_button 'New Late Policy'&lt;br /&gt;
  fill_in &amp;quot;policy_name&amp;quot;, with: 'Test Late Policy'&lt;br /&gt;
  fill_in &amp;quot;penalty_per_unit&amp;quot;, with: '15'&lt;br /&gt;
  fill_in &amp;quot;max_penalty&amp;quot;, with: '20'&lt;br /&gt;
  click_button 'Create'&lt;br /&gt;
  visit &amp;quot;/late_policies&amp;quot;&lt;br /&gt;
  click_button 'Back'&lt;br /&gt;
  expect(page).to route_to(&amp;quot;/assignments/#{assignment.id}/edit&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150206</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150206"/>
		<updated>2023-04-26T01:25:07Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150203</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=150203"/>
		<updated>2023-04-26T01:22:56Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. This fix is present within the current implementation.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
For the scope of our project, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test for flash error message on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test for back button interaction on new late policy page&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test for back button interaction on new late policy page while creating&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149685</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149685"/>
		<updated>2023-04-13T01:46:27Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. (This code was fixed in the previous PR, highlighting the modified code sections)&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Next, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149684</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149684"/>
		<updated>2023-04-13T01:45:52Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. (This code was fixed in the previous PR, highlighting the modified code sections)&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
Next, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149683</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149683"/>
		<updated>2023-04-13T01:45:36Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered. (This code was fixed in the previous PR, highlighting the modified code sections)&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
Next, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149680</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149680"/>
		<updated>2023-04-13T01:42:41Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
First, the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks was fixed. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. It was added and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
Next, we identified several code areas where the code can be DRIED or KISS principles can be applied. &lt;br /&gt;
* We extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149679</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149679"/>
		<updated>2023-04-13T01:38:05Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Later, we identified several code areas where the code can be DRIED. &lt;br /&gt;
  * To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  * To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  * To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149678</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149678"/>
		<updated>2023-04-13T01:37:19Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 * To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
 * To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
 * To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149677</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149677"/>
		<updated>2023-04-13T01:36:23Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  * To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  * To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  * To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149676</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149676"/>
		<updated>2023-04-13T01:35:59Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  *To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  *To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  *To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149675</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149675"/>
		<updated>2023-04-13T01:35:00Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
  To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
  To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149674</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149674"/>
		<updated>2023-04-13T01:34:30Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
***  To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
*** To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
*** To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149673</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149673"/>
		<updated>2023-04-13T01:33:59Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
**  To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
** To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
** To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149672</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149672"/>
		<updated>2023-04-13T01:33:32Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 *  To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
 * To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
 * To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149671</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149671"/>
		<updated>2023-04-13T01:33:10Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Later, we identified several code areas where the code can be DRIED. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
**  To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
** To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
** To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test successful assignment creation and redirection&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test redirection with error when assignment creation is invalid&lt;br /&gt;
|-&lt;br /&gt;
| 4 || Test setting assignment id within session&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In order to test the changes made within the create controller we have to introduce the following tests:&lt;br /&gt;
#Successful creation of an assignment and redirection to edit page&lt;br /&gt;
#Setting the assigment id within the session, so that it can be used in to route the 'Back' functionality&lt;br /&gt;
#Redirecting with error when assignment creation is invalid&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.describe AssignmentsController, type: :controller do&lt;br /&gt;
  describe '#create' do&lt;br /&gt;
    let(:course) { create(:course) }&lt;br /&gt;
    let(:valid_assignment_attributes) { attributes_for(:assignment, course_id: course.id) }&lt;br /&gt;
    let(:invalid_assignment_attributes) { attributes_for(:assignment, course_id: course.id, name: nil) }&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is valid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'creates a new assignment and redirects to the edit assignment page' do&lt;br /&gt;
        expect(response).to redirect_to(edit_assignment_path(Assignment.last))&lt;br /&gt;
        expect(flash[:success]).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'sets the session assignment_id to the new assignment ID' do&lt;br /&gt;
        expect(session[:assignment_id]).to eq(Assignment.last.id)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Create Assignment&amp;quot; button is clicked and the assignment is invalid' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Create Assignment', assignment_form: { assignment: invalid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'does not create a new assignment and redirects back to the new assignment page with an error message' do&lt;br /&gt;
        expect(response).to redirect_to(new_assignment_path(private: 1))&lt;br /&gt;
        expect(flash[:error]).to include('Failed to create assignment.')&lt;br /&gt;
        expect(flash[:error]).to include('Name can\'t be blank')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    context 'when the &amp;quot;Save&amp;quot; button is clicked' do&lt;br /&gt;
      before do&lt;br /&gt;
        post :create, params: { button: 'Save', assignment_form: { assignment: valid_assignment_attributes } }&lt;br /&gt;
      end&lt;br /&gt;
      &lt;br /&gt;
      it 'renders the new assignment page with an undo link' do&lt;br /&gt;
        expect(response).to render_template(:new)&lt;br /&gt;
        expect(assigns(:undo_link)).to eq('Assignment &amp;quot;Test Assignment&amp;quot; has been created successfully. ')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149667</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149667"/>
		<updated>2023-04-13T01:29:30Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Design Principle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the main issue which is fixing the backlinks and the error message displayed in Late Due Policy, which is explained at detail in the coming sections. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
We checked review comments provided for the last implementation and improved upon it. Hence we will not be updating existing design patterns, and instead will be introducing refactoring within the existing code, by identifying DRY codes wherever possible and apply KISS principle if necessary. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149661</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149661"/>
		<updated>2023-04-13T01:24:22Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID and applied DRY - KISS principles. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149657</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149657"/>
		<updated>2023-04-13T01:19:06Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks. The error was due to the parameter &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; not being present in session parameter list. We added it and made necessary changes wherever the &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt; was being rendered.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149647</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149647"/>
		<updated>2023-04-13T01:13:19Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified &amp;amp; changed the code in &amp;lt;code&amp;gt;assignments_controller.rb&amp;lt;/code&amp;gt; that is displaying an error in New late policy &amp;amp; breaking the backlinks.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149644</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149644"/>
		<updated>2023-04-13T01:11:53Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified the code in &amp;lt;code&amp;gt; assignments_controller.rb &amp;lt;/code&amp;gt; that is breaking the backlinks and changed it here.&lt;br /&gt;
[[File:E2327_change0.png|500px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149643</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149643"/>
		<updated>2023-04-13T01:11:15Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified the code in &amp;lt;code&amp;gt; assignments_controller.rb &amp;lt;/code&amp;gt; that is breaking the backlinks and changed it here.&lt;br /&gt;
[[File:E2327_change0.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149641</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149641"/>
		<updated>2023-04-13T01:10:39Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Changes made */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim of this Project ===&lt;br /&gt;
Te aim of this project is listed as follows:&lt;br /&gt;
&lt;br /&gt;
# Improving code structure and documentation via refactoring&lt;br /&gt;
# Adding code comments for parts of code refactored or improved&lt;br /&gt;
# Improving code readability&lt;br /&gt;
# Writing tests for any changes made&lt;br /&gt;
# Removing redundant or unused code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
===== '''Issue 1: Removing Error Message''' =====&lt;br /&gt;
Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
====='''Issue 2: Fixing Back Link''' =====&lt;br /&gt;
When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
====='''Issue 3: Fixing Back Link upon creation''' =====&lt;br /&gt;
After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Design Principle ==&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Solution and Files Refactored ==&lt;br /&gt;
=== Files Refactored or Modified ===&lt;br /&gt;
* assignment_form.rb&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* late_policy_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Changes made ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. &lt;br /&gt;
&lt;br /&gt;
* First, we identified the code that is breaking the backlinks and changed it here.&lt;br /&gt;
[[File:E2327_change0.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Next, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve code readability in the assignment controller, we have separated the functionality of updating the assignments form parameters. The update logic is now stored within a separate function 'update_form_params_with_existing' that is called within the create method of the controller.&lt;br /&gt;
[[File:e2327 1.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 2.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
* To improve the code readability, we have refactored the local variable names used within the assignment form as follows:&lt;br /&gt;
[[File:e2327 3.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[File:e2327 4.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test the refactoring for the copy method within the assignment_form.rb&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* To the test the refactored copy method of the assignment form, we have included a unit test to mock the creation of a new assignment and trigger the copy method of Assignment object. We then verify the various fields of the copied object to ensure correctness after code refactoring.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
&lt;br /&gt;
RSpec.describe Assignment, type: :model do&lt;br /&gt;
  describe '.copy' do&lt;br /&gt;
    let!(:user) { create(:user) }&lt;br /&gt;
    let!(:old_assignment) { create(:assignment) }&lt;br /&gt;
    &lt;br /&gt;
    it 'creates a copy of the assignment' do&lt;br /&gt;
      new_assignment_id = Assignment.copy(old_assignment.id, user)&lt;br /&gt;
      &lt;br /&gt;
      expect(new_assignment_id).not_to be_nil&lt;br /&gt;
      expect(old_assignment.name).not_to eq(new_assignment.name)&lt;br /&gt;
      expect(old_assignment.directory_path).not_to eq(new_assignment.directory_path)&lt;br /&gt;
      expect(old_assignment.copy_flag).not_to eq(new_assignment.copy_flag)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
=='''Reference'''==&lt;br /&gt;
[https://github.com/expertiza/expertiza/pull/2564 Github PR for E2327] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Main_Page Expertiza_wiki]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza Documentation]&lt;br /&gt;
&lt;br /&gt;
[https://github.com/expertiza/expertiza Expertiza Github]&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2327_change0.png&amp;diff=149640</id>
		<title>File:E2327 change0.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2327_change0.png&amp;diff=149640"/>
		<updated>2023-04-13T01:09:04Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149342</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149342"/>
		<updated>2023-04-08T19:07:21Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Team Members */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Description==&lt;br /&gt;
&lt;br /&gt;
=== Project Overview ===&lt;br /&gt;
Expertiza was created as an online platform to assist in peer reviewing and submission of academic work, which can include articles, codes, and websites. With this application, instructors are given the ability to add assignments, grade them, and allocate students into teams based on their preferred topics.&lt;br /&gt;
The Expertiza platform provides a 'Late Policy' feature that can be applied to any assignment, so that points are automatically deducted if a student submits or reviews projects or assignments late after the due date has passed.The Late Policy feature is implemented by applying the policy to an assignment through the Due Dates tab during creation or editing of an assignment.&lt;br /&gt;
The goal of this project is to address certain comments and issues associated with the solutions to the problems related to &amp;quot;Back&amp;quot; link on the &amp;quot;New Late Policy&amp;quot; page by making appropriate modifications and adding comprehensive test cases that cover all possible scenarios.&lt;br /&gt;
&lt;br /&gt;
==Project Scope==&lt;br /&gt;
&lt;br /&gt;
=== Aim: To address the issues in the current implementation ===&lt;br /&gt;
* Improve code structure and documentation via refactoring and add code comments&lt;br /&gt;
* Improve code readability&lt;br /&gt;
&lt;br /&gt;
=== Problems Resolved in the Current Implementation ===&lt;br /&gt;
==== Work Flow Diagram ====&lt;br /&gt;
[[File:Project_Scope_late.png]]&lt;br /&gt;
&lt;br /&gt;
==== Issues ====&lt;br /&gt;
The following problems have been covered and corrected in the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Under the “Due Date” tab when click on the &amp;quot;New late policy&amp;quot; link an error message shows up.&lt;br /&gt;
[[File:Issue-1.png|800px|]]&lt;br /&gt;
* '''Issue 2''' - When creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue2WhenBackisclicked.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creating a late policy, the “back” link does not take the user back to editing the assignment.&lt;br /&gt;
[[File:Issue-3FromList.png|800px|]]&lt;br /&gt;
&lt;br /&gt;
==== Resolution ====&lt;br /&gt;
The following are the screenshots after the issues were resolved within the current implementation:&lt;br /&gt;
&lt;br /&gt;
* '''Issue 1''' - Resolution where the error message doesn't show up.&lt;br /&gt;
[[File: Assignmentse2327.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Betterediting.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
* '''Issue 2''' - Displaying back link takes back to late policies&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
* '''Issue 3''' - After creation of late policy, back link takes back to late policies&lt;br /&gt;
[[File: Newlatepolicy.png|800px|]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[File: Latepolicy.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Solution and Files Refactored ===&lt;br /&gt;
We made the following refactorings within the existing solution to improve code readability and maintain sound workflow. First, we extracted the method that is responsible for maintaining a check on duplicate assignment name and directory path for a given course ID. To ensure that the create method is readable and responsible for carrying out only a single responsibility of creating the assignment, we have separated the checking responsibilities from the code:&lt;br /&gt;
[[File:Change1 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Change12 e2327.png|1000px|]] &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To improve the correctness of the code and avoid any illegal modifications of error messages, we have change the access modifier for the attribute error messages:&lt;br /&gt;
[[File:Change2 e2327.png|1000px|]] &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Design Principle ===&lt;br /&gt;
The aim of our project is to improve upon the existing implementation by addressing the review comments provided for the last implementation. Hence we will not be updating existing design patters, and instead will be introducing Refactoring within the existing code. &amp;lt;br&amp;gt;&lt;br /&gt;
Refactoring is the process of improving the structure, design, and/or implementation of an existing codebase without changing its external behavior. It involves making small, incremental changes to the code to make it more maintainable, easier to understand, and more efficient.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== RSpec Unit Tests ===&lt;br /&gt;
&lt;br /&gt;
We plan to provide RSpec Unit Tests within the Late Policy Spec page on top of the existing tests in the form of simple unit tests to ensure that our changes and modifications do not break the working logic of the existing implementation.&lt;br /&gt;
&lt;br /&gt;
====Tests====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left:30px&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Sr No !! Test Description &lt;br /&gt;
|-&lt;br /&gt;
| 1 || Test to create an assignment and check whether the error message shows up&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Test to create assignment and check Back button functionality&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Test to check Back button functionality without creation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Test Screenshots ===&lt;br /&gt;
&lt;br /&gt;
Will be added soon.&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
*When logging in as an instructor:&lt;br /&gt;
1. Edit an assignment by clicking on edit logo under the “Action” column. &amp;lt;br/&amp;gt;&lt;br /&gt;
2. Under the “Due Date” tab click on the &amp;quot;New late policy&amp;quot; link. &amp;lt;br/&amp;gt;&lt;br /&gt;
3. In “New late policy” fill in the required details.&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicks “Create” to save the policy, to go to page which shows all late policies.&amp;lt;br/&amp;gt;&lt;br /&gt;
5. Clicks “Back” to redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
Or&amp;lt;br/&amp;gt;&lt;br /&gt;
4. Clicking “Back”,  should redirect the instructor back to the “Due Date” tab of the assignment which was being edited.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
===Mentor ===&lt;br /&gt;
Divyang Doshi(ddoshi2@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Team Members ===&lt;br /&gt;
Amisha Bipin Waghela (awaghel@ncsu.edu) &amp;lt;br/&amp;gt;&lt;br /&gt;
Sasank Marabattula (smaraba@ncsu.edu)&amp;lt;br/&amp;gt;&lt;br /&gt;
Srilekha Gudipati (sngudipa@ncsu.edu)&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149110</id>
		<title>CSC/ECE 517 Spring 2023 - E2327. Fix Back link on New Late Policy page</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2327._Fix_Back_link_on_New_Late_Policy_page&amp;diff=149110"/>
		<updated>2023-04-07T20:44:16Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: Created page with &amp;quot;CSC/ECE 517 Spring 2023 - E2327. Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CSC/ECE 517 Spring 2023 - E2327. Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148447</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148447"/>
		<updated>2023-03-27T22:17:36Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Coverage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as evident from the below image.Firstly, we have added new tests to cover more edge cases and Secondly, the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
[[File:Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;edit method&amp;lt;/code&amp;gt;, we added a test for when team with given id that exists. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
Also, for test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, added a test case for when incorrect parameters are passed.&lt;br /&gt;
&lt;br /&gt;
[[File:incorrect_parameters.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;#bequeath_all&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrect_parameters.png&amp;diff=148445</id>
		<title>File:Incorrect parameters.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrect_parameters.png&amp;diff=148445"/>
		<updated>2023-03-27T22:16:23Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: Smaraba uploaded a new version of File:Incorrect parameters.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148444</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148444"/>
		<updated>2023-03-27T22:15:44Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Added Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as evident from the below image.&lt;br /&gt;
[[File:Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;edit method&amp;lt;/code&amp;gt;, we added a test for when team with given id that exists. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
Also, for test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, added a test case for when incorrect parameters are passed.&lt;br /&gt;
&lt;br /&gt;
[[File:incorrect_parameters.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;#bequeath_all&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrect_parameters.png&amp;diff=148443</id>
		<title>File:Incorrect parameters.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Incorrect_parameters.png&amp;diff=148443"/>
		<updated>2023-03-27T22:13:41Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148442</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148442"/>
		<updated>2023-03-27T22:12:14Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Added Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as evident from the below image.&lt;br /&gt;
[[File:Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;edit method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
Also, for test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, added a test case for when incorrect parameters are passed.&lt;br /&gt;
&lt;br /&gt;
[[File:incorrect_parameters.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;#bequeath_all&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148441</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148441"/>
		<updated>2023-03-27T22:09:43Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Coverage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as evident from the below image.&lt;br /&gt;
[[File:Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;#bequeath_all&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148440</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148440"/>
		<updated>2023-03-27T22:01:08Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
[[File:Coverage.png]]&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;#bequeath_all&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.png&amp;diff=148439</id>
		<title>File:Coverage.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Coverage.png&amp;diff=148439"/>
		<updated>2023-03-27T21:59:41Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: Smaraba uploaded a new version of File:Coverage.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148438</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148438"/>
		<updated>2023-03-27T21:56:35Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;#bequeath_all&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148437</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148437"/>
		<updated>2023-03-27T21:54:18Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which was redundant, because a create method will ideally be called with a team that doesn't exist. Therefore, we removed this test.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt; (lines 180 - 220). Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt; (lines 222 - 266).&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148436</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148436"/>
		<updated>2023-03-27T21:52:11Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests1.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_tests1.png&amp;diff=148435</id>
		<title>File:Added tests1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_tests1.png&amp;diff=148435"/>
		<updated>2023-03-27T21:51:48Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_tests.png&amp;diff=148433</id>
		<title>File:Added tests.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_tests.png&amp;diff=148433"/>
		<updated>2023-03-27T21:50:50Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: Smaraba uploaded a new version of File:Added tests.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_tests.png&amp;diff=148432</id>
		<title>File:Added tests.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_tests.png&amp;diff=148432"/>
		<updated>2023-03-27T21:49:47Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: Smaraba uploaded a new version of File:Added tests.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148431</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148431"/>
		<updated>2023-03-27T21:49:31Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, we found more edge cases that need to be tested, hence we added two new test cases. There was a test which was commented, it is found to be not required, and hence it was removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. We also added a code when team with given id does not exist. &lt;br /&gt;
&lt;br /&gt;
[[File:added_tests.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148423</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148423"/>
		<updated>2023-03-27T21:06:12Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Fix #2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, new test cases were added, some test cases had to be removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. Below is the change&lt;br /&gt;
[[File:added_tests.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148422</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148422"/>
		<updated>2023-03-27T21:05:00Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Fix #2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&amp;lt;code&amp;gt;#find teams still need team members and users who are not in any team&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, new test cases were added, some test cases had to be removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. Below is the change&lt;br /&gt;
[[File:added_tests.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148421</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148421"/>
		<updated>2023-03-27T21:04:33Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Files Changed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
    # find teams still need team members and users who are not in any team&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, new test cases were added, some test cases had to be removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. Below is the change&lt;br /&gt;
[[File:added_tests.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148420</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148420"/>
		<updated>2023-03-27T21:04:21Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Issues Fixed */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;team.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/teams.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
    # find teams still need team members and users who are not in any team&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, new test cases were added, some test cases had to be removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. Below is the change&lt;br /&gt;
[[File:added_tests.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148419</id>
		<title>CSC/ECE 517 Spring 2023 - E2303 Refactor teams controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2023_-_E2303_Refactor_teams_controller.rb&amp;diff=148419"/>
		<updated>2023-03-27T21:03:54Z</updated>

		<summary type="html">&lt;p&gt;Smaraba: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Expertiza==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
In this project we refactored teams_controller.rb and some associated files with it. Some duplicate code was removed. We added some comments for readability. Also, the hindi yml file was modified to enhance it.&lt;br /&gt;
&lt;br /&gt;
==Issues Fixed==&lt;br /&gt;
&lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments and briefly explained the functionality of all methods&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
#* Refactored the function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; to improve readability by including function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Refactored function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; that calls &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt;, which calls &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on bequeath &lt;br /&gt;
# Refactored code in &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
#* Added more comments to some methods in the code&lt;br /&gt;
#* Found areas in the code where the DRY principle can be applied&lt;br /&gt;
# Made changes to &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; file, by adding more annotations and some grammatical errors&lt;br /&gt;
# Added more coverage to test by modifying &amp;lt;code&amp;gt;teams_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Files Changed==&lt;br /&gt;
&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/models/teams.rb&lt;br /&gt;
* config/locales/hi_IN.yml&lt;br /&gt;
* spec/controllers/teams_controller_spec.rb&lt;br /&gt;
* expertiza/app/views/teams/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Changes==&lt;br /&gt;
&lt;br /&gt;
===Fix #1===&lt;br /&gt;
&lt;br /&gt;
The code in &amp;lt;code&amp;gt;teams_controller.rb&amp;lt;/code&amp;gt; for function &amp;lt;code&amp;gt;bequeath_all&amp;lt;/code&amp;gt; was too long, which would make it unreadable. To achieve it, a function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; was added to the code. &lt;br /&gt;
 &amp;lt;nowiki&amp;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] == Team.allowed_types[1]&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;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
The function &amp;lt;code&amp;gt;copy_teams&amp;lt;/code&amp;gt; is refactored further to improve it. The function &amp;lt;code&amp;gt;choose_copy_type&amp;lt;/code&amp;gt; is refactored further to either perform &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; based on team operation. &lt;br /&gt;
 &amp;lt;nowiki&amp;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;
# Abstraction over different methods&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;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #2===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;teams.rb&amp;lt;/code&amp;gt; had an area where DRY principle could be applied. Function &amp;lt;code&amp;gt;randomize_all_by_parent&amp;lt;/code&amp;gt; was modified to decrease the number of lines of code. The snippet to find teams still need team members and users who are not in any team has been modified, below is the code snippet.&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
    # find teams still need team members and users who are not in any team&lt;br /&gt;
    teams = Team.where(parent_id: parent.id, type: parent.class.to_s + 'Team').to_a&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 }&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Fix #3===&lt;br /&gt;
&lt;br /&gt;
The file &amp;lt;code&amp;gt;hi_IN.yml&amp;lt;/code&amp;gt; has some formatting in annotations that needed to be taken care of. For example, in Hindi, a sentence ending is indicated by the symbol &amp;quot;|&amp;quot;, but it is given as &amp;quot;.&amp;quot; everywhere. This was taken care of in the code, wherever Hindi annotations are available. Also, some additional annotations were added for &amp;lt;code&amp;gt;datetime-&amp;gt;distance_in_words&amp;lt;/code&amp;gt; key, where the annotations were modified to maintain uniformity throughout this key.&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
The teams controller testing document has been covered well by the previous teams, however after detailed analysis of the test file, new test cases were added, some test cases had to be removed, while some of them had to be modified to correction.&lt;br /&gt;
&lt;br /&gt;
===Test Coverage===&lt;br /&gt;
&lt;br /&gt;
Coverage has slightly improved, as the number of lines in team.rb file has decreased as a result of refactoring.&lt;br /&gt;
&lt;br /&gt;
======Added Tests======&lt;br /&gt;
&lt;br /&gt;
'''1.''' In the test &amp;lt;code&amp;gt;create teams method&amp;lt;/code&amp;gt;, we added a test for incorrect parameters passed into the method. Below is the change&lt;br /&gt;
[[File:added_tests.png]]&lt;br /&gt;
&lt;br /&gt;
======Modified Tests======&lt;br /&gt;
&lt;br /&gt;
'''2.''' In the test &amp;lt;code&amp;gt; create method&amp;lt;/code&amp;gt;, there was a test case which looked redundant, as it wasn't working earlier as well and it was already covered in the test file.&lt;br /&gt;
&lt;br /&gt;
[[File:removed_nonworking_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''3.''' There was some confusion about the function &amp;lt;code&amp;gt;choose_copy_type, bequeath_copy and inherit_copy&amp;lt;/code&amp;gt;. In the test &amp;lt;code&amp;gt;inherit method&amp;lt;/code&amp;gt;, the function &amp;lt;code&amp;gt;inherit_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course and team is not empty&amp;lt;/code&amp;gt;. Similarly, &amp;lt;code&amp;gt;bequeath_copy&amp;lt;/code&amp;gt; was tested under &amp;lt;code&amp;gt;called when assignment belongs to course but team is empty&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:inherit_confusion_test.png]]&lt;br /&gt;
&lt;br /&gt;
'''4.''' In the test &amp;lt;code&amp;gt; delete method&amp;lt;/code&amp;gt;, some redundant comments were made, that was removed as well.&lt;br /&gt;
&lt;br /&gt;
'''5.''' Some minor changes were made to some of the test cases.&lt;br /&gt;
&lt;br /&gt;
==Contributors==&lt;br /&gt;
This project was done as part of Dr. Edward Gehringer's &amp;quot;CSC/ECE 517: Object-Oriented Design and Development&amp;quot; class, Spring 2023. The contributors were: Sasank Marabattula, Srilekha Gudipati and Varun Deepak Gudhe. Our project mentor was Divyang Doshi.&lt;/div&gt;</summary>
		<author><name>Smaraba</name></author>
	</entry>
</feed>