<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/index.php?action=history&amp;feed=atom&amp;title=User%3ASpurush</id>
	<title>User:Spurush - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/index.php?action=history&amp;feed=atom&amp;title=User%3ASpurush"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;action=history"/>
	<updated>2026-04-18T19:44:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;diff=151040&amp;oldid=prev</id>
		<title>Spurush at 19:13, 31 October 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;diff=151040&amp;oldid=prev"/>
		<updated>2023-10-31T19:13:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:13, 31 October 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l258&quot;&gt;Line 258:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 258:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/del&gt;==References&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==References==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Spurush</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;diff=151039&amp;oldid=prev</id>
		<title>Spurush at 19:12, 31 October 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;diff=151039&amp;oldid=prev"/>
		<updated>2023-10-31T19:12:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:12, 31 October 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l261&quot;&gt;Line 261:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 261:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://github.com/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;WintersLt&lt;/del&gt;/expertiza GitHub Project Repository Fork]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://github.com/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;samarth-p&lt;/ins&gt;/expertiza GitHub Project Repository Fork]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#[http://bit.ly/myexpertiza  Demo link] &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#[https://relishapp.com/rspec Rspec Documentation]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Spurush</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;diff=151038&amp;oldid=prev</id>
		<title>Spurush: Created page with &quot;==E2368. Reimplement due_date.rb==  This page provides a description of the Expertiza based OSS project.    __TOC__   ===About Expertiza===  [http://expertiza.ncsu.edu/ Expert...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=User:Spurush&amp;diff=151038&amp;oldid=prev"/>
		<updated>2023-10-31T19:10:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==E2368. Reimplement due_date.rb==  This page provides a description of the Expertiza based OSS project.    __TOC__   ===About Expertiza===  [http://expertiza.ncsu.edu/ Expert...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&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;
* Removed methods used exclusively in test files.&lt;br /&gt;
* Created a new file, due_date_helper.rb, to handle specific functionalities.&lt;br /&gt;
* Moved pertinent methods from the model class to the new helper class.&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;
* Renamed methods to accurately describe their responsibilities.&lt;br /&gt;
* Addressed identified code smells and issues using Code Climate analysis.&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 three key points:&lt;br /&gt;
&lt;br /&gt;
=== Deadline and Time Handling ===&lt;br /&gt;
The class manages due dates for various elements within an assignment. It includes functionalities to:&lt;br /&gt;
* Determine the current due date based on time comparisons.&lt;br /&gt;
* Check for teammate review allowance based on due dates.&lt;br /&gt;
* Set flags and validate due date formats.&lt;br /&gt;
&lt;br /&gt;
=== Assignment and Topic-Based Due Date Retrieval ===&lt;br /&gt;
The class retrieves the next due date for assignments or topics. It includes logic to:&lt;br /&gt;
* Handle staggered deadlines for topics and fallback procedures for unavailable topic-specific due dates.&lt;br /&gt;
* Retrieve assignment-specific due dates considering the current time.&lt;br /&gt;
&lt;br /&gt;
=== Functionality for Assignment Duplication ===&lt;br /&gt;
The class offers methods to handle due date duplication between assignments. It includes functionalities to:&lt;br /&gt;
* Copy due dates from one assignment to another.&lt;br /&gt;
* Set due dates for assignments based on various parameters.&lt;br /&gt;
* Calculate assignment-specific rounds for responses like author feedback, quizzes, and reviews based on deadlines.&lt;br /&gt;
&lt;br /&gt;
This `DueDate` class serves as a central component within the Expertiza project for managing and handling due dates, validation, and retrieval concerning assignment and deadline management.&lt;br /&gt;
== Improvements in the New Implementation of DueDate Class ==&lt;br /&gt;
&lt;br /&gt;
The changes made in the new implementation of the `DueDate` class addressed several issues, along with their corresponding solutions:&lt;br /&gt;
&lt;br /&gt;
=== Removed methods used only in the test files ===&lt;br /&gt;
* '''Problem''': The code contained methods tailored exclusively for testing, leading to unnecessary clutter and potential confusion within the primary codebase.&lt;br /&gt;
* '''Solution''': Removal of test-specific methods streamlined the code, enhancing focus and clarity, ensuring that the main code is more comprehensible for developers working on functional components.&lt;br /&gt;
&lt;br /&gt;
The method `set_duedate` was originally housed in the `due_date.rb` file and was later relocated to the `due_date_spec.rb` file within the Expertiza project. This method is responsible for setting a due date.&lt;br /&gt;
&lt;br /&gt;
The relocated `set_duedate` method performs the following tasks:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.set_duedate(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;
=== Created a new due_date_helper.rb file ===&lt;br /&gt;
* '''Problem''': The primary model class had an abundance of methods, including helper functions, affecting readability and maintainability.&lt;br /&gt;
* '''Solution''': The establishment of a dedicated file for due date helper methods segregated the code, enabling a clear distinction between model-specific functions and those supporting due date functionalities, leading to improved modularity and organization.&lt;br /&gt;
&lt;br /&gt;
=== Moved relevant methods from the model class to the helper class ===&lt;br /&gt;
* '''Problem''': The model class contained methods better suited for helper functions, violating the Single Responsibility Principle and causing complexity.&lt;br /&gt;
* '''Solution''': Relocating pertinent methods to the helper class aligned the code with the Single Responsibility Principle, enhancing maintainability and organization by ensuring distinct purposes for each class.&lt;br /&gt;
&lt;br /&gt;
Below are the contents of the newly implemented file app/helpers/due_date_helper.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# frozen_string_literal: true&lt;br /&gt;
&lt;br /&gt;
# app/helpers/due_date_helper.rb&lt;br /&gt;
&lt;br /&gt;
# This module contains helper methods related to due dates.&lt;br /&gt;
module DueDateHelper&lt;br /&gt;
  def self.deadline_sort(due_dates)&lt;br /&gt;
    # Override the comparator operator to sort due dates by due_at&lt;br /&gt;
    due_dates.sort { |m1, m2| m1.due_at.to_i &amp;lt;=&amp;gt; m2.due_at.to_i }&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;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;
&lt;br /&gt;
Before refactoring&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;
    # for author feedback, quiz, teammate review and metareview, Expertiza only support one round, so the round # should be 1&lt;br /&gt;
    return 0 if ResponseMap.find(response.map_id).type != 'ReviewResponseMap'&lt;br /&gt;
&lt;br /&gt;
    due_dates = DueDate.where(parent_id: assignment_id)&lt;br /&gt;
    # sorted so that the earliest deadline is at the first&lt;br /&gt;
    sorted_deadlines = deadline_sort(due_dates)&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;
    round = 1&lt;br /&gt;
    sorted_deadlines.each do |due_date|&lt;br /&gt;
      break if response.created_at &amp;lt; due_date.due_at&lt;br /&gt;
&lt;br /&gt;
      round += 1 if due_date.deadline_type_id == 2&lt;br /&gt;
    end&lt;br /&gt;
    round&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def self.calculate_assignment_round(assignment_id, response)&lt;br /&gt;
    return 0 unless ResponseMap.find(response.map_id).type == 'ReviewResponseMap'&lt;br /&gt;
&lt;br /&gt;
    due_dates = DueDate.where(parent_id: assignment_id)&lt;br /&gt;
    sorted_deadlines = deadline_sort(due_dates)&lt;br /&gt;
    determine_assignment_round(response, sorted_deadlines)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.determine_assignment_round(response, sorted_due_dates)&lt;br /&gt;
    round = 1&lt;br /&gt;
    sorted_due_dates.each do |due_date|&lt;br /&gt;
      break if response.created_at &amp;lt; due_date.due_at&lt;br /&gt;
&lt;br /&gt;
      round += 1 if due_date.deadline_type_id == 2&lt;br /&gt;
    end&lt;br /&gt;
    round&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;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;
Before Renaming&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;
def self.set_duedate(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.get_next_due_date(assignment_id, topic_id = nil)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def self.calculate_assignment_round(assignment_id, response)&lt;br /&gt;
..&lt;br /&gt;
def set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
..&lt;br /&gt;
def self.find_next_topic_due_date(assignment_id, topic_id)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Fixed code smells using Code Climate ===&lt;br /&gt;
* '''Problem''': Code Climate identified issues like inefficiencies, redundancies, or style violations, potentially impacting code quality and maintainability.&lt;br /&gt;
* '''Solution''': Addressing Code Climate's feedback resolved potential issues, leading to an optimized, robust, and maintainable codebase aligning with higher standards.&lt;br /&gt;
&lt;br /&gt;
Before refactoring, the same block of code given below was present in due_date_spec.rb and due_date_helper_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
before(:each) do&lt;br /&gt;
    @deadline_type = build(:deadline_type)&lt;br /&gt;
    @deadline_right = build(:deadline_right)&lt;br /&gt;
    @assignment_due_date = build(:assignment_due_date, deadline_type: @deadline_type,&lt;br /&gt;
                                                       submission_allowed_id: @deadline_right.id, review_allowed_id: @deadline_right.id,&lt;br /&gt;
                                                       review_of_review_allowed_id: @deadline_right.id, due_at: '2015-12-30 23:30:12')&lt;br /&gt;
&lt;br /&gt;
    @due_dates = []&lt;br /&gt;
    10.times.each do |n|&lt;br /&gt;
      date = if n == 1 || n == 9&lt;br /&gt;
               nil&lt;br /&gt;
             else&lt;br /&gt;
               Time.zone.now - 60 * n&lt;br /&gt;
             end&lt;br /&gt;
      @due_dates &amp;lt;&amp;lt; build(:assignment_due_date, due_at: date)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring, we created a new file spec/support/shared_contexts.rb to house the common block of code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RSpec.shared_context 'with_deadline_setup' do&lt;br /&gt;
  before(:each) do&lt;br /&gt;
    @deadline_type = build(:deadline_type)&lt;br /&gt;
    @deadline_right = build(:deadline_right)&lt;br /&gt;
    @assignment_due_date = build(&lt;br /&gt;
      :assignment_due_date,&lt;br /&gt;
      deadline_type: @deadline_type,&lt;br /&gt;
      submission_allowed_id: @deadline_right.id,&lt;br /&gt;
      review_allowed_id: @deadline_right.id,&lt;br /&gt;
      review_of_review_allowed_id: @deadline_right.id,&lt;br /&gt;
      due_at: '2015-12-30 23:30:12'&lt;br /&gt;
    )&lt;br /&gt;
&lt;br /&gt;
    @due_dates = []&lt;br /&gt;
    10.times.each do |n|&lt;br /&gt;
      date = if n == 1 || n == 9&lt;br /&gt;
               nil&lt;br /&gt;
             else&lt;br /&gt;
               Time.zone.now - 60 * n&lt;br /&gt;
             end&lt;br /&gt;
      @due_dates &amp;lt;&amp;lt; build(:assignment_due_date, due_at: date)&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;
By recognizing these problems and applying their respective solutions, the new implementation of the `DueDate` class aims to enhance code quality, readability, and maintainability within the Expertiza project.&lt;br /&gt;
&lt;br /&gt;
==Tests==&lt;br /&gt;
&lt;br /&gt;
Created a new file spec/helpers/due_date_helper_spec.rb to handle all the validation for due_date_helper module. Below are some examples - &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'support/shared_contexts'&lt;br /&gt;
&lt;br /&gt;
describe DueDateHelper do&lt;br /&gt;
  def set_due_date(duedate, deadline, assign_id, max_round)&lt;br /&gt;
    ActiveRecord::Base.transaction do&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;
  end&lt;br /&gt;
&lt;br /&gt;
  include_context 'with_deadline_setup'&lt;br /&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;
&lt;br /&gt;
    sorted_due_dates = DueDateHelper.deadline_sort(@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 true&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#calculate_assignment_round' do&lt;br /&gt;
    it 'return 0 when no response map' do&lt;br /&gt;
      response = ReviewResponseMap.create&lt;br /&gt;
      response.type = 'ResponseMap'&lt;br /&gt;
      response.save&lt;br /&gt;
      expect(DueDateHelper.calculate_assignment_round(1, response)).to eql 0&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;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/WintersLt/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://bit.ly/myexpertiza  Demo link] &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>Spurush</name></author>
	</entry>
</feed>