<?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=Dukolhat</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=Dukolhat"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Dukolhat"/>
	<updated>2026-05-07T01:07:40Z</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_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=156940</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=156940"/>
		<updated>2024-04-29T03:56:39Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
==Class Diagram==&lt;br /&gt;
[[File:UML_diagram_Due_Date.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming class methods to instance methods in the DueDate class requires considering how these methods will interact with the individual state of each instance, rather than operating at the class level. This transformation ensures that methods directly utilize the properties of an individual instance of the class. Here's a structured plan for each class method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, as a class method, this might work by accepting an identifier for a DueDate instance (such as id) to locate and update a specific record. To convert it to an instance method, remove the need for an identifier parameter, and allow the method to directly manipulate the attribute of the instance it's called on. The signature would change from set_flag(id) to just set_flag, utilizing the instance's own data.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method might currently be designed to accept a datetime string at the class level. Converting this to an instance method involves removing the parameter and directly checking the instance's due_at attribute to see if it is a valid datetime. This aligns better with Rails conventions where validations typically operate on instance data, ensuring that each object maintains its integrity before saving or updating.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, converting this from a class method to an instance method aligns with its conventional use. The spaceship operator is intended to compare two instances of the same class. As an instance method, it would naturally compare the calling instance to another instance passed as a parameter, facilitating direct and intuitive comparison of attributes like due dates within the same class.&lt;br /&gt;
&lt;br /&gt;
The transformation from class methods to instance methods typically means moving from a broad, generalized operation to focusing on the specific attributes and behavior of individual instances. This change often simplifies method signatures by eliminating the need for additional parameters to identify specific instances since the method naturally operates on the instance from which it is called. For functionalities like validations or comparisons (spaceship operator), this shift enhances practicality and aligns well with object-oriented programming principles in Rails, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PR.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=156687</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=156687"/>
		<updated>2024-04-24T03:15:21Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
==Class Diagram==&lt;br /&gt;
[[File:UML_diagram_Due_Date.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PR.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=156686</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=156686"/>
		<updated>2024-04-24T03:15:02Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
==Class Diagram==&lt;br /&gt;
[[File:UML_diagram_Due_Date.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
[[File:PR.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:PR.png&amp;diff=156682</id>
		<title>File:PR.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:PR.png&amp;diff=156682"/>
		<updated>2024-04-24T03:14:39Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155727</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155727"/>
		<updated>2024-04-21T18:12:12Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
==Class Diagram==&lt;br /&gt;
[[File:UML_diagram_Due_Date.png|600px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155726</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155726"/>
		<updated>2024-04-21T18:11:54Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
==Class Diagram==&lt;br /&gt;
[[File:UML_diagram_Due_Date.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_diagram_Due_Date.png&amp;diff=155725</id>
		<title>File:UML diagram Due Date.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:UML_diagram_Due_Date.png&amp;diff=155725"/>
		<updated>2024-04-21T18:11:04Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155706</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155706"/>
		<updated>2024-04-19T21:30:32Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155705</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155705"/>
		<updated>2024-04-19T21:30:03Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
OLD CODE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NEW CODE:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
    	due_date = self.class.current(student.assignment.due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155704</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155704"/>
		<updated>2024-04-19T21:28:49Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class was responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods were refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method focused solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class was eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, was refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class were encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods was limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class depended on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control was used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our last testing iteration, we enhanced the readability, maintainability, and coverage of our DueDate model tests using RSpec. We achieved this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we organized our tests into contextual groupings using descriptive describe blocks. Each block encapsulated different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach improved the readability of our test suite by providing clear and logical groupings. Additionally, we employed helper methods within the before(:each) block to streamline setup logic. These methods handled common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we leveraged mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we mocked the required dependencies rather than relying on real database records. This approach sped up tests and isolated the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we paid attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we ensured the robustness of our model and handled unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions were reviewed to ensure clarity and completeness. We verified that each test covered all expected outcomes and that assertions were clear and concise. For instance, in tests like copying due dates to a new assignment, we not only checked the count but also verified that due dates in the new assignment matched the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We also focused on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we ensured that error handling scenarios were covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grew, we monitored test performance using RSpec's profiling tools and optimized slow tests as needed. Additionally, we documented our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we created a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155703</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155703"/>
		<updated>2024-04-19T19:54:54Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments had staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class will be responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods will be refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method will focus solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class will be encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control will be used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155701</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155701"/>
		<updated>2024-04-19T15:08:47Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
#Our refactoring initiative encompassed specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we embarked on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we included comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we focused on enhancing variable and method names. In the done_in_assignment_round method, we renamed variables like due_dates to assignment_due_dates for clarity. Additionally, we renamed the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions was another key aspect. For example, in the done_in_assignment_round method, we extracted the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts involved reviewing database queries for efficiency. In the get_next_due_date method, we optimized the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements included refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we provided more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices was ensured throughout the refactoring process. We leveraged Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we utilized ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we implemented thorough unit tests using frameworks like RSpec or Minitest. For instance, we wrote tests to verify the behavior of the set_flag method and ensured it correctly updated the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we documented our progress and collaborated effectively using version control systems like Git. Code reviews provided valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase. By undertaking these specific actions, we aimed to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class will be responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods will be refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method will focus solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class will be encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control will be used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=155699</id>
		<title>CSC/ECE 517 Spring 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=155699"/>
		<updated>2024-04-19T00:54:18Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2024 - E2401 Implementing and testing import &amp;amp; export controllers]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2405 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2407 Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2428 Replicate Roles and Institution UIs ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2429 Reimplement student_task list]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2430 Reimplement student_task view]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding ]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2414 Grading Audit Trail]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - NTNX-1 : Extend NDB Operator to Support Postgres HA]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - ‬NTNX-2‬‭ : Snapshot Functionality for provisioned databases]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2411 : Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2416.  Reimplement the Question hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2420. Reimplement student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2424. Reimplement the Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2426. Create a UI for Assignment Edit page &amp;quot;Etc&amp;quot; tab in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2417. Reimplement submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2417. Reimplement submitted content controller.rb (Phase 2)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2425. Create a Courses user interface in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2431. Reimplement  grades/view_team]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2404 Refactor student teams functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2406 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2421. Reimplement impersonating users (within impersonate controller.rb)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2413. Testing - Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2412. Testing for hamer.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2427. UI for questionnaire.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2419. Reimplement duties controller.rb and badges controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2432. UI for Participants.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2402 Implement REST client, REST API, and Graphql API endpoint for repositories]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2400 DevOp for GitHub Miner app]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2439 Testing for view_translation_substitutor.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2443 Reimplement grades_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2434 Reimplement Frontend for the Grades view]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2435 Implement Frontend for the My Profile]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2446 Implement Front End for Student Task List]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2444 Implement Frontend for the Review]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2440 Testing for questionnaire_helper, review_bids_helper]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2433 Implement UI for the Student Teams]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2415. Reimplement responses controller.rb (Design Document)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2445. Implement BackEnd for participants.rb (Design Document)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2441 Reimplement grades/view_team (Phase 2)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)]]&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155698</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155698"/>
		<updated>2024-04-19T00:51:22Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing class methods to instance methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Class to Instance Methods:&amp;lt;/b&amp;gt; Changing as many class methods to instance methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Class Methods to Instance Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming class methods to instance methods in the DueDate class requires considering how these methods will interact with the individual state of each instance, rather than operating at the class level. This transformation ensures that methods directly utilize the properties of an individual instance of the class. Here's a structured plan for each class method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, as a class method, this might work by accepting an identifier for a DueDate instance (such as id) to locate and update a specific record. To convert it to an instance method, remove the need for an identifier parameter, and allow the method to directly manipulate the attribute of the instance it's called on. The signature would change from set_flag(id) to just set_flag, utilizing the instance's own data.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method might currently be designed to accept a datetime string at the class level. Converting this to an instance method involves removing the parameter and directly checking the instance's due_at attribute to see if it is a valid datetime. This aligns better with Rails conventions where validations typically operate on instance data, ensuring that each object maintains its integrity before saving or updating.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, converting this from a class method to an instance method aligns with its conventional use. The spaceship operator is intended to compare two instances of the same class. As an instance method, it would naturally compare the calling instance to another instance passed as a parameter, facilitating direct and intuitive comparison of attributes like due dates within the same class.&lt;br /&gt;
&lt;br /&gt;
The transformation from class methods to instance methods typically means moving from a broad, generalized operation to focusing on the specific attributes and behavior of individual instances. This change often simplifies method signatures by eliminating the need for additional parameters to identify specific instances since the method naturally operates on the instance from which it is called. For functionalities like validations or comparisons (spaceship operator), this shift enhances practicality and aligns well with object-oriented programming principles in Rails, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
====Single Responsibility Principle (SRP):====&lt;br /&gt;
Each method in the DueDate class will be responsible for a specific task related to managing due dates.&lt;br /&gt;
Methods will be refactored to separate concerns such as setting due dates, retrieving due dates, and performing operations on due dates.&lt;br /&gt;
For example, the set_duedate method will focus solely on setting the due date for a task.&lt;br /&gt;
&lt;br /&gt;
====Don't Repeat Yourself (DRY) Principle:====&lt;br /&gt;
Code duplication in the DueDate class will be eliminated by extracting common functionality into helper methods or modules.&lt;br /&gt;
Repetitive logic, such as date calculations or formatting, will be refactored to promote code reusability and maintainability.&lt;br /&gt;
&lt;br /&gt;
====Encapsulation:====&lt;br /&gt;
Data and behavior within the DueDate class will be encapsulated within appropriate instance methods and attributes to minimize dependencies.&lt;br /&gt;
Access to instance variables and methods will be limited, promoting encapsulation and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
====Dependency Inversion Principle (DIP):====&lt;br /&gt;
The DueDate class will depend on abstractions, interfaces, or higher-level modules instead of concrete implementations.&lt;br /&gt;
Dependency injection or inversion of control will be used to decouple the class from specific date manipulation implementations, allowing for flexibility and easier testing.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (aspatil2@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155283</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155283"/>
		<updated>2024-04-09T00:15:34Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Karnatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (apatil@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155280</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155280"/>
		<updated>2024-04-09T00:14:49Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
=====Mentor===== &lt;br /&gt;
*Kalyan Kainatı&lt;br /&gt;
&lt;br /&gt;
=====Members===== &lt;br /&gt;
*Atharva Patil (apatil@ncsu.edu)&lt;br /&gt;
*Deepika Choudhary Patibandla (@ncsu.edu)&lt;br /&gt;
*Dhruv Kolhatkar (dukolhat@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155277</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155277"/>
		<updated>2024-04-09T00:13:26Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
#Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&amp;lt;br&amp;gt;&lt;br /&gt;
#Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&amp;lt;br&amp;gt;&lt;br /&gt;
#Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality. Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&amp;lt;br&amp;gt;&lt;br /&gt;
#Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&amp;lt;br&amp;gt;&lt;br /&gt;
#Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&amp;lt;br&amp;gt;&lt;br /&gt;
#Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&amp;lt;br&amp;gt;&lt;br /&gt;
#To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&amp;lt;br&amp;gt;&lt;br /&gt;
#Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155273</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155273"/>
		<updated>2024-04-09T00:11:36Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&lt;br /&gt;
&lt;br /&gt;
Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&lt;br /&gt;
&lt;br /&gt;
Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality.&lt;br /&gt;
&lt;br /&gt;
Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&lt;br /&gt;
&lt;br /&gt;
Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&lt;br /&gt;
&lt;br /&gt;
Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&lt;br /&gt;
&lt;br /&gt;
To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&lt;br /&gt;
&lt;br /&gt;
Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.&lt;br /&gt;
&lt;br /&gt;
By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings. Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs. As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155272</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155272"/>
		<updated>2024-04-09T00:11:18Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&lt;br /&gt;
&lt;br /&gt;
Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&lt;br /&gt;
&lt;br /&gt;
Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality.&lt;br /&gt;
&lt;br /&gt;
Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&lt;br /&gt;
&lt;br /&gt;
Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&lt;br /&gt;
&lt;br /&gt;
Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&lt;br /&gt;
&lt;br /&gt;
To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&lt;br /&gt;
&lt;br /&gt;
Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.&lt;br /&gt;
&lt;br /&gt;
By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings.&lt;br /&gt;
Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs.&lt;br /&gt;
As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155268</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155268"/>
		<updated>2024-04-09T00:10:49Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&lt;br /&gt;
&lt;br /&gt;
Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&lt;br /&gt;
&lt;br /&gt;
Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality.&lt;br /&gt;
&lt;br /&gt;
Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&lt;br /&gt;
&lt;br /&gt;
Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&lt;br /&gt;
&lt;br /&gt;
Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&lt;br /&gt;
&lt;br /&gt;
To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&lt;br /&gt;
&lt;br /&gt;
Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.&lt;br /&gt;
&lt;br /&gt;
By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
#Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings.&amp;lt;br&amp;gt;&lt;br /&gt;
Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&amp;lt;br&amp;gt;&lt;br /&gt;
#To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&amp;lt;br&amp;gt;&lt;br /&gt;
#Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&amp;lt;br&amp;gt;&lt;br /&gt;
#Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&amp;lt;br&amp;gt;&lt;br /&gt;
#We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs.&lt;br /&gt;
As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&amp;lt;br&amp;gt;&lt;br /&gt;
#By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155266</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155266"/>
		<updated>2024-04-09T00:09:22Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
====Refactoring due_date.rb:====&lt;br /&gt;
Our refactoring initiative will encompass specific actions to improve code clarity, optimize performance, and bolster maintainability across our application.&lt;br /&gt;
&lt;br /&gt;
Firstly, we'll embark on adding descriptive comments throughout the codebase. For instance, within the teammate_review_allowed? method, we'll include comments explaining the logic behind determining whether teammate review is allowed, making it easier for developers to understand the function's purpose and behavior.&lt;br /&gt;
&lt;br /&gt;
Secondly, we'll focus on enhancing variable and method names. In the done_in_assignment_round method, we'll rename variables like due_dates to assignment_due_dates for clarity. Additionally, we'll rename the copy method to duplicate_due_dates to better convey its functionality.&lt;br /&gt;
&lt;br /&gt;
Breaking down complex methods into smaller, focused functions will be another key aspect. For example, in the done_in_assignment_round method, we'll extract the logic for sorting and filtering due dates into separate helper methods, improving readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
Optimization efforts will involve reviewing database queries for efficiency. In the get_next_due_date method, we'll optimize the query by using ActiveRecord query methods or adding appropriate database indexes to speed up retrieval of due dates, especially in cases where assignments have staggered deadlines or multiple topics.&lt;br /&gt;
&lt;br /&gt;
Robustness enhancements will include refining error handling mechanisms. For instance, in the due_at_is_valid_datetime method, we'll provide more informative error messages to guide developers in identifying and resolving invalid datetime inputs.&lt;br /&gt;
&lt;br /&gt;
Adherence to Ruby and Rails best practices will be ensured throughout the refactoring process. We'll leverage Rails conventions and built-in functionalities wherever possible. For example, in the set_flag method, we'll utilize ActiveRecord's update method with attribute names instead of update_attribute for improved code clarity and safety.&lt;br /&gt;
&lt;br /&gt;
To mitigate against regressions, we'll implement thorough unit tests using frameworks like RSpec or Minitest. For instance, we'll write tests to verify the behavior of the set_flag method and ensure it correctly updates the flag attribute.&lt;br /&gt;
&lt;br /&gt;
Lastly, we'll document our progress and collaborate effectively using version control systems like Git. Code reviews will provide valuable feedback on adherence to coding standards and best practices, ensuring consistency and quality across the codebase.&lt;br /&gt;
&lt;br /&gt;
By undertaking these specific actions, we aim to transform our codebase into a more readable, efficient, and maintainable state, facilitating ongoing development and enhancement of our application.&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
====Testing with Rspec:====&lt;br /&gt;
At our next testing iteration, we plan to enhance the readability, maintainability, and coverage of our DueDate model tests using RSpec. We aim to achieve this by implementing several key strategies.&lt;br /&gt;
&lt;br /&gt;
Firstly, we'll organize our tests into contextual groupings using descriptive describe blocks. Each block will encapsulate different aspects of the model's functionality, such as validation, manipulation, and behavior under specific conditions. This approach will improve the readability of our test suite by providing clear and logical groupings.&lt;br /&gt;
&lt;br /&gt;
Additionally, we'll employ helper methods within the before(:each) block to streamline setup logic. These methods will handle common setup tasks, such as creating due dates with various attributes, reducing repetition, and making the test setup more concise and understandable.&lt;br /&gt;
&lt;br /&gt;
To ensure test efficiency and isolation, we'll leverage mocking techniques to simulate dependencies where necessary. For methods relying on complex associations or external data, we'll mock the required dependencies rather than relying on real database records. This approach speeds up tests and isolates the behavior under test.&lt;br /&gt;
&lt;br /&gt;
Furthermore, we'll pay attention to edge cases, ensuring comprehensive test coverage by including scenarios such as nil due dates, absence of response maps, and staggered deadline variations. By testing these edge cases, we'll ensure the robustness of our model and handle unexpected scenarios gracefully.&lt;br /&gt;
&lt;br /&gt;
Our test assertions will be reviewed to ensure clarity and completeness. We'll verify that each test covers all expected outcomes and that assertions are clear and concise. For instance, in tests like copying due dates to a new assignment, we'll not only check the count but also verify that due dates in the new assignment match the originals.&lt;br /&gt;
&lt;br /&gt;
We'll also focus on error handling, testing both error and success paths thoroughly. For methods like due_at_is_valid_datetime, we'll ensure that error handling scenarios are covered comprehensively, guaranteeing robustness in the face of unexpected inputs.&lt;br /&gt;
&lt;br /&gt;
As our test suite grows, we'll monitor test performance using RSpec's profiling tools and optimize slow tests as needed. Additionally, we'll document our tests with comments or descriptions to clarify the purpose of each test, aiding understanding for future maintainers and contributing to overall code quality.&lt;br /&gt;
&lt;br /&gt;
By implementing these strategies, we aim to create a comprehensive, maintainable, and efficient test suite for our DueDate model using RSpec.&lt;br /&gt;
&lt;br /&gt;
== Design Principles ==&lt;br /&gt;
&lt;br /&gt;
=== Testing with RSwag: ===&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155238</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155238"/>
		<updated>2024-04-08T23:53:42Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155237</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155237"/>
		<updated>2024-04-08T23:53:20Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
&lt;br /&gt;
#For the &amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155236</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155236"/>
		<updated>2024-04-08T23:52:28Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb (Phase 2)==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
We're refactoring the due_dates.rb in Expertiza, enhancing its codebase to adhere to DRY and design principles, improving readability, and reducing redundancy. Our focus includes changing instance methods to class methods and further testing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
The reimplementation project entails:&lt;br /&gt;
#&amp;lt;b&amp;gt;Refactoring due_date.rb:&amp;lt;/b&amp;gt; Enhancing code clarity, optimizing, and adding comments for unclear lines of code to improve maintainability and readability.&lt;br /&gt;
#&amp;lt;b&amp;gt;Removing Redundant Methods:&amp;lt;/b&amp;gt; Identifying and eliminating unused methods in the controller to reduce complexity and streamline functionality.&lt;br /&gt;
#&amp;lt;b&amp;gt;Instance to Class Methods:&amp;lt;/b&amp;gt; Changing as many instance methods to class methods as possible.&lt;br /&gt;
#&amp;lt;b&amp;gt;Adherence to DRY Principle:&amp;lt;/b&amp;gt; Ensuring that the reimplementation follows the Don't Repeat Yourself (DRY) principle to avoid duplication and improve code efficiency.&lt;br /&gt;
#&amp;lt;b&amp;gt;Testing with Rspec:&amp;lt;/b&amp;gt; Writing comprehensive tests using Rspec for each method to ensure functionality and integration, followed by a video demonstration showcasing the functionality of the reimplementation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Plan for Reimplementation of DueDate==&lt;br /&gt;
&lt;br /&gt;
====Instance Methods to Class Methods:====&lt;br /&gt;
&lt;br /&gt;
Transforming instance methods to class methods in the DueDate class requires a strategic approach, taking into account the context and usage of these methods within the broader application. This transformation ensures that methods don't rely on the state of a particular instance of the class but rather, operate at the class level, possibly requiring additional parameters to act upon data that would have been inherent to the instance. Here's a structured plan for each instance method identified in the provided code:&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;1. set_flag:&amp;lt;/b&amp;gt; Currently, this method updates an attribute of a specific instance. To convert it into a class method, it would need to accept an identifier for the DueDate instance (such as id) as a parameter. The class method would then locate the specific instance within the database and update its attribute. The signature would change from set_flag to something like self.set_flag(id), where id is used to find the DueDate instance and update it.&lt;br /&gt;
&lt;br /&gt;
#&amp;lt;b&amp;gt;2. due_at_is_valid_datetime:&amp;lt;/b&amp;gt; This validation method checks if the due_at attribute of an instance is a valid datetime. To change this into a class method, it would need to accept a datetime string as a parameter. However, validations in Rails models are inherently designed to be instance methods since they operate on the attributes of a specific instance before saving or updating it. Instead of transforming this into a class method, consider whether it's more appropriate to keep as an instance method or refactor the validation logic elsewhere where it can be used more generically.&lt;br /&gt;
&lt;br /&gt;
3. For the #&amp;lt;b&amp;gt;&amp;lt;=&amp;gt; (spaceship operator) method&amp;lt;/b&amp;gt;, transforming it into a class method doesn't follow the conventional use of class methods or the purpose of the spaceship operator. The spaceship operator is used to compare two instances of the same class. Its use as a class method would be unconventional and counterintuitive since it's designed to operate on instances. If there's a compelling reason to compare data at the class level, consider implementing a separate class method that takes identifiers or attributes of two entities as parameters to perform the comparison, but this would be a deviation from the typical use of the &amp;lt;=&amp;gt; operator.&lt;br /&gt;
&lt;br /&gt;
The transformation from instance methods to class methods often means changing the scope from operating on a single, specific instance to handling a broader class-level operation. This usually involves adding parameters to methods that were previously not needed because the instance itself held the context. Moreover, for some functionalities like validations or comparisons (&amp;lt;=&amp;gt; operator), the shift might not be practical or align with Rails conventions and object-oriented principles. It's crucial to assess the necessity and implications of such changes on the overall design and maintainability of the codebase.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155222</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb_(Phase_2)&amp;diff=155222"/>
		<updated>2024-04-08T23:40:11Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: Created page with &amp;quot;==E2418. Reimplement due_date.rb==  This page provides a description of the Expertiza based OSS project.    __TOC__   ===About Expertiza===  [http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form tea...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 self.flag = true&lt;br /&gt;
	 save&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.deadline_type_id = deadline&lt;br /&gt;
	 submit_duedate.parent_id = assign_id&lt;br /&gt;
	 submit_duedate.round = max_round&lt;br /&gt;
	 submit_duedate.save&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 update_attribute(:flag, true)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.update(deadline_type_id: deadline, parent_id: assign_id, round: max_round)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.sort_deadlines(due_dates)&lt;br /&gt;
	 due_dates.sort do |m1, m2|&lt;br /&gt;
  	 if m1.due_at &amp;amp;&amp;amp; m2.due_at&lt;br /&gt;
    	 m1.due_at &amp;lt;=&amp;gt; m2.due_at&lt;br /&gt;
  	 elsif m1.due_at&lt;br /&gt;
    	 -1&lt;br /&gt;
  	 else&lt;br /&gt;
    	 1&lt;br /&gt;
  	 end&lt;br /&gt;
	end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
..&lt;br /&gt;
def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = sort_deadlines(due_dates)&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def &amp;lt;=&amp;gt;(other)&lt;br /&gt;
	return nil unless other.is_a?(DueDate)&lt;br /&gt;
&lt;br /&gt;
	if due_at &amp;amp;&amp;amp; other.due_at&lt;br /&gt;
  	due_at &amp;lt;=&amp;gt; other.due_at&lt;br /&gt;
	elsif due_at&lt;br /&gt;
  	-1&lt;br /&gt;
	else&lt;br /&gt;
  	1&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = due_dates.sort&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 it 'sort duedate records' do&lt;br /&gt;
	 sorted_due_dates = @due_dates&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql false&lt;br /&gt;
	 sorted_due_dates = @due_dates.sort&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql true&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All tests passed successfully:&lt;br /&gt;
[[File:DueDateTest.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153721</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153721"/>
		<updated>2024-03-24T20:49:03Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 self.flag = true&lt;br /&gt;
	 save&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.deadline_type_id = deadline&lt;br /&gt;
	 submit_duedate.parent_id = assign_id&lt;br /&gt;
	 submit_duedate.round = max_round&lt;br /&gt;
	 submit_duedate.save&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 update_attribute(:flag, true)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.update(deadline_type_id: deadline, parent_id: assign_id, round: max_round)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.sort_deadlines(due_dates)&lt;br /&gt;
	 due_dates.sort do |m1, m2|&lt;br /&gt;
  	 if m1.due_at &amp;amp;&amp;amp; m2.due_at&lt;br /&gt;
    	 m1.due_at &amp;lt;=&amp;gt; m2.due_at&lt;br /&gt;
  	 elsif m1.due_at&lt;br /&gt;
    	 -1&lt;br /&gt;
  	 else&lt;br /&gt;
    	 1&lt;br /&gt;
  	 end&lt;br /&gt;
	end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
..&lt;br /&gt;
def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = sort_deadlines(due_dates)&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def &amp;lt;=&amp;gt;(other)&lt;br /&gt;
	return nil unless other.is_a?(DueDate)&lt;br /&gt;
&lt;br /&gt;
	if due_at &amp;amp;&amp;amp; other.due_at&lt;br /&gt;
  	due_at &amp;lt;=&amp;gt; other.due_at&lt;br /&gt;
	elsif due_at&lt;br /&gt;
  	-1&lt;br /&gt;
	else&lt;br /&gt;
  	1&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = due_dates.sort&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 it 'sort duedate records' do&lt;br /&gt;
	 sorted_due_dates = @due_dates&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql false&lt;br /&gt;
	 sorted_due_dates = @due_dates.sort&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql true&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All tests passed successfully:&lt;br /&gt;
[[File:DueDateTest.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153720</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153720"/>
		<updated>2024-03-24T20:48:44Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 self.flag = true&lt;br /&gt;
	 save&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.deadline_type_id = deadline&lt;br /&gt;
	 submit_duedate.parent_id = assign_id&lt;br /&gt;
	 submit_duedate.round = max_round&lt;br /&gt;
	 submit_duedate.save&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 update_attribute(:flag, true)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.update(deadline_type_id: deadline, parent_id: assign_id, round: max_round)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.sort_deadlines(due_dates)&lt;br /&gt;
	 due_dates.sort do |m1, m2|&lt;br /&gt;
  	 if m1.due_at &amp;amp;&amp;amp; m2.due_at&lt;br /&gt;
    	 m1.due_at &amp;lt;=&amp;gt; m2.due_at&lt;br /&gt;
  	 elsif m1.due_at&lt;br /&gt;
    	 -1&lt;br /&gt;
  	 else&lt;br /&gt;
    	 1&lt;br /&gt;
  	 end&lt;br /&gt;
	end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
..&lt;br /&gt;
def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = sort_deadlines(due_dates)&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def &amp;lt;=&amp;gt;(other)&lt;br /&gt;
	return nil unless other.is_a?(DueDate)&lt;br /&gt;
&lt;br /&gt;
	if due_at &amp;amp;&amp;amp; other.due_at&lt;br /&gt;
  	due_at &amp;lt;=&amp;gt; other.due_at&lt;br /&gt;
	elsif due_at&lt;br /&gt;
  	-1&lt;br /&gt;
	else&lt;br /&gt;
  	1&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = due_dates.sort&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 it 'sort duedate records' do&lt;br /&gt;
	 sorted_due_dates = @due_dates&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql false&lt;br /&gt;
	 sorted_due_dates = @due_dates.sort&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql true&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All tests running:&lt;br /&gt;
[[File:DueDateTest.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateTest.png&amp;diff=153719</id>
		<title>File:DueDateTest.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateTest.png&amp;diff=153719"/>
		<updated>2024-03-24T20:48:36Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153714</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153714"/>
		<updated>2024-03-24T20:43:01Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 self.flag = true&lt;br /&gt;
	 save&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.deadline_type_id = deadline&lt;br /&gt;
	 submit_duedate.parent_id = assign_id&lt;br /&gt;
	 submit_duedate.round = max_round&lt;br /&gt;
	 submit_duedate.save&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 update_attribute(:flag, true)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.update(deadline_type_id: deadline, parent_id: assign_id, round: max_round)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.sort_deadlines(due_dates)&lt;br /&gt;
	 due_dates.sort do |m1, m2|&lt;br /&gt;
  	 if m1.due_at &amp;amp;&amp;amp; m2.due_at&lt;br /&gt;
    	 m1.due_at &amp;lt;=&amp;gt; m2.due_at&lt;br /&gt;
  	 elsif m1.due_at&lt;br /&gt;
    	 -1&lt;br /&gt;
  	 else&lt;br /&gt;
    	 1&lt;br /&gt;
  	 end&lt;br /&gt;
	end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
..&lt;br /&gt;
def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = sort_deadlines(due_dates)&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def &amp;lt;=&amp;gt;(other)&lt;br /&gt;
	return nil unless other.is_a?(DueDate)&lt;br /&gt;
&lt;br /&gt;
	if due_at &amp;amp;&amp;amp; other.due_at&lt;br /&gt;
  	due_at &amp;lt;=&amp;gt; other.due_at&lt;br /&gt;
	elsif due_at&lt;br /&gt;
  	-1&lt;br /&gt;
	else&lt;br /&gt;
  	1&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = due_dates.sort&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 it 'sort duedate records' do&lt;br /&gt;
	 sorted_due_dates = @due_dates&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql false&lt;br /&gt;
	 sorted_due_dates = @due_dates.sort&lt;br /&gt;
	 expect(sorted_due_dates.each_cons(2).all? { |m1, m2| (m1.due_at &amp;lt;=&amp;gt; m2.due_at) != 1 }).to eql true&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153707</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153707"/>
		<updated>2024-03-24T20:36:46Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 self.flag = true&lt;br /&gt;
	 save&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.deadline_type_id = deadline&lt;br /&gt;
	 submit_duedate.parent_id = assign_id&lt;br /&gt;
	 submit_duedate.round = max_round&lt;br /&gt;
	 submit_duedate.save&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def set_flag&lt;br /&gt;
	 update_attribute(:flag, true)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
	 submit_duedate = DueDate.new(duedate)&lt;br /&gt;
	 submit_duedate.update(deadline_type_id: deadline, parent_id: assign_id, round: max_round)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.sort_deadlines(due_dates)&lt;br /&gt;
	 due_dates.sort do |m1, m2|&lt;br /&gt;
  	 if m1.due_at &amp;amp;&amp;amp; m2.due_at&lt;br /&gt;
    	 m1.due_at &amp;lt;=&amp;gt; m2.due_at&lt;br /&gt;
  	 elsif m1.due_at&lt;br /&gt;
    	 -1&lt;br /&gt;
  	 else&lt;br /&gt;
    	 1&lt;br /&gt;
  	 end&lt;br /&gt;
	end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
..&lt;br /&gt;
def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = sort_deadlines(due_dates)&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def &amp;lt;=&amp;gt;(other)&lt;br /&gt;
	return nil unless other.is_a?(DueDate)&lt;br /&gt;
&lt;br /&gt;
	if due_at &amp;amp;&amp;amp; other.due_at&lt;br /&gt;
  	due_at &amp;lt;=&amp;gt; other.due_at&lt;br /&gt;
	elsif due_at&lt;br /&gt;
  	-1&lt;br /&gt;
	else&lt;br /&gt;
  	1&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
    ..&lt;br /&gt;
    sorted_deadlines = due_dates.sort&lt;br /&gt;
    ..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153695</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153695"/>
		<updated>2024-03-24T20:32:50Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153690</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153690"/>
		<updated>2024-03-24T20:31:12Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153685</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153685"/>
		<updated>2024-03-24T20:29:55Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed?(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.sort_deadlines(due_dates)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
Old Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	# Get the current due date from list of due dates&lt;br /&gt;
	due_dates.each do |due_date|&lt;br /&gt;
  	if due_date.due_at &amp;gt; Time.now&lt;br /&gt;
    	current_due_date = due_date&lt;br /&gt;
    	return current_due_date&lt;br /&gt;
  	end&lt;br /&gt;
	end&lt;br /&gt;
	# in case current due date not found&lt;br /&gt;
	nil&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	# time when teammate review is allowed&lt;br /&gt;
	due_date = current(student.assignment.due_dates)&lt;br /&gt;
	student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	due_date &amp;amp;&amp;amp;&lt;br /&gt;
    	(due_date.teammate_review_allowed_id == 3 ||&lt;br /&gt;
    	due_date.teammate_review_allowed_id == 2) # late(2) or yes(3)&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     duedates = where(parent_id: old_assignment_id)&lt;br /&gt;
     duedates.each do |orig_due_date|&lt;br /&gt;
   	 ..&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	..&lt;br /&gt;
	 due_dates.reject { |due_date| due_date.deadline_type_id != 1 &amp;amp;&amp;amp; due_date.deadline_type_id != 2 }&lt;br /&gt;
..&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
New Code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.current(due_dates)&lt;br /&gt;
	 due_dates.detect { |due_date| due_date.due_at &amp;gt; Time.now }&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.teammate_review_allowed?(student)&lt;br /&gt;
	 # time when teammate review is allowed&lt;br /&gt;
	 due_date = current(student.assignment.due_dates)&lt;br /&gt;
	 student.assignment.find_current_stage == 'Finished' ||&lt;br /&gt;
  	 (due_date &amp;amp;&amp;amp; [2, 3].include?(due_date.teammate_review_allowed_id))&lt;br /&gt;
 end&lt;br /&gt;
..&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.copy(old_assignment_id, new_assignment_id)&lt;br /&gt;
     where(parent_id: old_assignment_id).each do |orig_due_date|&lt;br /&gt;
   	  ..&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;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def self.done_in_assignment_round(assignment_id, response)&lt;br /&gt;
	 ..&lt;br /&gt;
	 due_dates.reject { |due_date| ![1, 2].include?(due_date.deadline_type_id) }&lt;br /&gt;
..&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153660</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153660"/>
		<updated>2024-03-24T20:22:52Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
OLD:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.current_due_date(due_dates)&lt;br /&gt;
..&lt;br /&gt;
def self.teammate_review_allowed(student)&lt;br /&gt;
..&lt;br /&gt;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.deadline_sort(due_dates)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153183</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153183"/>
		<updated>2024-03-23T22:31:55Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2418. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153182</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153182"/>
		<updated>2024-03-23T22:22:34Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2368. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
All the previous test cases pass in the new implementation of the system.&lt;br /&gt;
The following outlines the NEW scenario and cases to be tested for the &amp;lt;=&amp;gt; functionality within the system:&lt;br /&gt;
&lt;br /&gt;
=== Sorting Due Dates ===&lt;br /&gt;
* Scenario: Verify that due dates are sorted in the correct order.&lt;br /&gt;
* Edge Case: Include due dates with identical timestamps to assess the stability of the sorting algorithm.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153180</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153180"/>
		<updated>2024-03-23T22:18:16Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2368. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan for DueDateHelper Specs ==&lt;br /&gt;
&lt;br /&gt;
The following outlines the scenarios and cases to be tested for the DueDateHelper functionality within the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153179</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153179"/>
		<updated>2024-03-23T22:17:05Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2368. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Utilized Rails built-in APIs for tasks such as validation, scoping, and database access.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
=== Utilized Rails built-in APIs for tasks such as validation, scoping, and database access ===&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRails2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan for DueDateHelper Specs ==&lt;br /&gt;
&lt;br /&gt;
The following outlines the scenarios and cases to be tested for the DueDateHelper functionality within the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRails2.png&amp;diff=153178</id>
		<title>File:DueDateRails2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRails2.png&amp;diff=153178"/>
		<updated>2024-03-23T22:16:51Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRails1.png&amp;diff=153177</id>
		<title>File:DueDateRails1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRails1.png&amp;diff=153177"/>
		<updated>2024-03-23T22:16:39Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153176</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153176"/>
		<updated>2024-03-23T22:12:53Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2368. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
* Overrode the comparator operator for the DueDate class and replace the `deadline_sort` class method.&lt;br /&gt;
* Conducted code smell checks using Code Climate&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
=== Overrode the comparator operator for the DueDate class and replaced the `deadline_sort` class method ===&lt;br /&gt;
* '''Problem''': Existing code had a dedicated method for sorting due dates, which violated Ruby conventions.&lt;br /&gt;
* '''Solution''': Overrode the &amp;lt;=&amp;gt; operator and defined a new function for sorting due_dates and called that instead.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateOverride3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan for DueDateHelper Specs ==&lt;br /&gt;
&lt;br /&gt;
The following outlines the scenarios and cases to be tested for the DueDateHelper functionality within the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateOverride3.png&amp;diff=153175</id>
		<title>File:DueDateOverride3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateOverride3.png&amp;diff=153175"/>
		<updated>2024-03-23T22:12:27Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateOverride2.png&amp;diff=153174</id>
		<title>File:DueDateOverride2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateOverride2.png&amp;diff=153174"/>
		<updated>2024-03-23T22:12:15Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateOverride1.png&amp;diff=153173</id>
		<title>File:DueDateOverride1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateOverride1.png&amp;diff=153173"/>
		<updated>2024-03-23T22:12:03Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153171</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153171"/>
		<updated>2024-03-23T21:51:36Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2368. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan for DueDateHelper Specs ==&lt;br /&gt;
&lt;br /&gt;
The following outlines the scenarios and cases to be tested for the DueDateHelper functionality within the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153170</id>
		<title>CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2418._Reimplement_of_due_date.rb&amp;diff=153170"/>
		<updated>2024-03-23T21:50:59Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E2368. Reimplement due_date.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
== Project Changes ==&lt;br /&gt;
In this project, the following specific changes were implemented:&lt;br /&gt;
&lt;br /&gt;
* Renamed methods and variables to accurately describe their responsibilities.&lt;br /&gt;
* Refactored each method to comply with DRY (Don't Repeat Yourself), SRP (Single Responsibility Principle), and other Ruby conventions.&lt;br /&gt;
*&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
These changes aimed to enhance code quality, organization, and adherence to best practices in the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
== Current Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The current implementation of the `DueDate` class can be summarized in a few key points:&lt;br /&gt;
&lt;br /&gt;
=== Validation of Due Date Format ===&lt;br /&gt;
The class includes a validation method due_at_is_valid_datetime to ensure that the due date is in a valid datetime format. It checks if the due_at attribute is present and attempts to parse it using DateTime.strptime. If parsing fails and raises an ArgumentError, the method adds an error to the due_at attribute indicating that it must be a valid datetime.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Handling ===&lt;br /&gt;
The class provides a default_permission method, which retrieves the default permission for a given deadline type and permission type. It accesses the DEFAULT_PERMISSION constant defined in the DeadlineRight module and returns the corresponding permission value.&lt;br /&gt;
&lt;br /&gt;
=== Current Due Date Retrieval ===&lt;br /&gt;
It offers functionality through the current_due_date method to retrieve the current due date from a list of due dates. This method iterates over the provided due dates and checks if any due date lies in the future compared to the current time. It returns the first future due date encountered, indicating the current due date.&lt;br /&gt;
&lt;br /&gt;
=== Flag Setting ===&lt;br /&gt;
It includes a set_flag method to set the flag attribute to true for a DueDate instance. This method updates the flag attribute and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Copying ===&lt;br /&gt;
The class implements functionality to copy due dates from one assignment to another using the copy method. It retrieves due dates associated with a given assignment ID, duplicates each due date record, assigns the new parent ID, and saves the duplicated records for the new assignment.&lt;br /&gt;
&lt;br /&gt;
=== Due Date Setting ===&lt;br /&gt;
Provides a set_duedate method to set due dates for assignments with specified parameters. It creates a new DueDate instance with the provided parameters, including the deadline type, parent assignment ID, round, and saves the record to the database.&lt;br /&gt;
&lt;br /&gt;
===Sorting of Due Dates ===&lt;br /&gt;
Implements a method deadline_sort to sort due dates based on the due date attribute. This method sorts the provided list of due dates in ascending order of their due dates, ensuring that due dates without due_at values are placed at the end.&lt;br /&gt;
&lt;br /&gt;
=== Assignment Round Calculation ===&lt;br /&gt;
Calculates the round of the response within an assignment based on due dates using the done_in_assignment_round method. It retrieves due dates associated with the given assignment ID, sorts them by due date, and iterates over them to determine the round based on the response's creation time.&lt;br /&gt;
&lt;br /&gt;
=== Next Due Date Retrieval ===&lt;br /&gt;
Offers functionality through the get_next_due_date method to retrieve the next due date for an assignment or topic. Depending on whether the assignment has staggered deadlines, it queries either AssignmentDueDate or TopicDueDate records and returns the next due date after the current time.&lt;br /&gt;
&lt;br /&gt;
The DueDate class in the Expertiza project serves as a pivotal component responsible for managing, validating, and retrieving due dates associated with assignments, encompassing functionalities such as validation of datetime formats, permission handling, and determining the current and next due dates for assignments and topics.&lt;br /&gt;
&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
=== Renamed methods to describe their responsibility ===&lt;br /&gt;
* '''Problem''': Method names might not have accurately described their functionality, leading to confusion for developers.&lt;br /&gt;
* '''Solution''': Method renaming with descriptive names clarified their purpose, improving code readability and comprehension for developers to understand method functionalities without deep code inspection.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRename5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
=== Refactored each method according to DRY, SRP, and other Ruby conventions ===&lt;br /&gt;
* '''Problem''': Methods were potentially repetitive, non-optimized, or didn't adhere to best practices, causing inefficiencies and confusion.&lt;br /&gt;
* '''Solution''': Method refactoring according to DRY, SRP, and Ruby conventions optimized the code for clarity, efficiency, and maintainability, ensuring each method has a clear purpose and follows standard practices.&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby1.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby2.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby3.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby4.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
[[File:DueDateRuby5.png|1000px|thumb|none|]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Test Plan for DueDateHelper Specs ==&lt;br /&gt;
&lt;br /&gt;
The following outlines the scenarios and cases to be tested for the DueDateHelper functionality within the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/Dhruv-Kolhatkar/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby2.png&amp;diff=153169</id>
		<title>File:DueDateRuby2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby2.png&amp;diff=153169"/>
		<updated>2024-03-23T21:50:17Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby4.png&amp;diff=153168</id>
		<title>File:DueDateRuby4.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby4.png&amp;diff=153168"/>
		<updated>2024-03-23T21:49:59Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby3.png&amp;diff=153167</id>
		<title>File:DueDateRuby3.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby3.png&amp;diff=153167"/>
		<updated>2024-03-23T21:49:45Z</updated>

		<summary type="html">&lt;p&gt;Dukolhat: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dukolhat</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby1.png&amp;diff=153166</id>
		<title>File:DueDateRuby1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:DueDateRuby1.png&amp;diff=153166"/>
		<updated>2024-03-23T21:48:10Z</updated>

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