<?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=Njayann</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=Njayann"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Njayann"/>
	<updated>2026-05-11T22:40:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2373._Reimplement_teams_controllers.rb&amp;diff=151530</id>
		<title>CSC/ECE 517 Fall 2023 - E2373. Reimplement teams controllers.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2373._Reimplement_teams_controllers.rb&amp;diff=151530"/>
		<updated>2023-11-16T00:47:59Z</updated>

		<summary type="html">&lt;p&gt;Njayann: Created page with &amp;quot;===Description of Project===  The project involves a comprehensive restructuring of the teams_controller.rb file and the team.rb model within an application handling team func...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Description of Project===&lt;br /&gt;
&lt;br /&gt;
The project involves a comprehensive restructuring of the teams_controller.rb file and the team.rb model within an application handling team functionalities in assignments or courses. The primary focus includes adhering to the Single Responsibility Principle (SRP) by reorganizing methods to have singular, focused tasks and separating team-copying functionalities. Additionally, the effort involves refining function names for better clarity and readability and enhancing comments across the codebase to improve understanding. This overhaul aims to optimize the codebase for maintainability and readability while preserving or enhancing the functionality of team-related operations in the application.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement revolves around the inefficiencies and complexities present in the teams_controller.rb file and the team.rb model within an application managing team functionalities for assignments or courses. These inefficiencies primarily stem from violations of the Single Responsibility Principle (SRP), evident in functions that encompass multiple tasks and unclearly named functions that hinder code readability. Additionally, inadequate comments further exacerbate the code's readability issues. The challenge is to refactor these components, focusing on SRP compliance by restructuring methods, improving naming conventions for better understanding, and enhancing comments to facilitate code comprehension. The goal is to optimize the codebase for maintainability and readability while preserving or enhancing the functionality of team-related operations in the application.&lt;br /&gt;
&lt;br /&gt;
===Objectives===&lt;br /&gt;
&lt;br /&gt;
1. Single Responsibility Principle (SRP) Adherence&lt;br /&gt;
&lt;br /&gt;
*Refactor methods in teams_controller.rb and team.rb model to ensure each function has a singular, focused responsibility.&lt;br /&gt;
*Separate team-related functionalities like copying between assignments/courses for better code organization.&lt;br /&gt;
&lt;br /&gt;
2. Improved Naming Conventions&lt;br /&gt;
&lt;br /&gt;
*Rename ambiguous or confusingly named functions in both teams_controller.rb and team.rb for enhanced code readability and understanding.&lt;br /&gt;
&lt;br /&gt;
3. Enhanced Comments and Documentation&lt;br /&gt;
&lt;br /&gt;
*Improve and add comments throughout the codebase to provide clearer explanations of complex functionalities and enhance overall code comprehension.&lt;br /&gt;
*Document significant changes made during refactoring to aid future maintenance and development.&lt;br /&gt;
&lt;br /&gt;
4. Code Refactoring and Consolidation&lt;br /&gt;
&lt;br /&gt;
*Identify and eliminate code repetitions across functions to streamline the codebase, enhancing maintainability and reducing redundancy.&lt;br /&gt;
&lt;br /&gt;
5. Testing and Validation&lt;br /&gt;
&lt;br /&gt;
*Create or update unit tests to ensure the correctness and functionality of refactored methods in both the teams_controller.rb and team.rb model.&lt;br /&gt;
*Conduct integration testing to verify the overall functionality of team-related operations post-refactoring.&lt;br /&gt;
&lt;br /&gt;
The objectives aim to optimize the codebase by adhering to SRP principles, improving code readability through better naming conventions and comments, consolidating code where possible, and ensuring thorough testing for functionality validation.&lt;br /&gt;
&lt;br /&gt;
===Development Strategy===&lt;br /&gt;
&lt;br /&gt;
Our development strategy centers around Test-Driven Development (TDD) principles applied to refactoring the teams_controller.rb and team.rb model. Starting with the creation of failing test cases, we iteratively refactor code to address identified inefficiencies while ensuring successful test outcomes.&lt;br /&gt;
&lt;br /&gt;
Additionally, we emphasize the adoption of a &amp;quot;Slim controller, Fat model&amp;quot; paradigm inspired by Rails conventions. Our goal is to migrate complex functionalities from the controller to the model, fostering a more organized and maintainable codebase. This approach not only enhances code clarity within the controller but also promotes reusability and scalability across the application.&lt;br /&gt;
&lt;br /&gt;
===Project Design and Implementation===&lt;br /&gt;
&lt;br /&gt;
Taking into account the current functionalities within the teams_controller.rb and team.rb model, our approach involves embracing the Strategy Pattern within the controller, capitalizing on its capability to encapsulate distinct controller actions. This strategic implementation aims to ensure seamless extensibility and enhanced usability. By employing this pattern, we establish a structured framework for defining and managing the diverse operations the controller handles, promoting a more organized and manageable code structure.&lt;br /&gt;
&lt;br /&gt;
==== Functionality ====&lt;br /&gt;
In this project, we aim to add functions for the following:&lt;br /&gt;
&lt;br /&gt;
1. Refactoring for SRP:&lt;br /&gt;
*Reorganizing code in teams_controller.rb and team.rb to adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
2. Naming and Comment Improvements:&lt;br /&gt;
*Enhancing function and method names for clarity.&lt;br /&gt;
*Adding and refining comments for better code comprehension.&lt;br /&gt;
&lt;br /&gt;
3. Code Optimization:&lt;br /&gt;
*Identifying and removing redundant code segments to streamline the codebase.&lt;br /&gt;
&lt;br /&gt;
4. Testing and Validation:&lt;br /&gt;
*Creating or updating tests to ensure the accuracy of refactored methods.&lt;br /&gt;
*Conducting integration tests to verify overall functionality post-refactoring.&lt;br /&gt;
&lt;br /&gt;
===Testing Plan===&lt;br /&gt;
&lt;br /&gt;
We plan to employ RSpec for comprehensive testing of the teams_controller.rb and team.rb model. Leveraging FactoryBot, we'll construct the necessary test fixtures and models for thorough testing. Our approach involves utilizing the existing test skeleton provided while enhancing test coverage and minimizing code smells. Considering the current functionalities, our defined tests aim to validate the restructured code in the teams_controller.rb and team.rb model, verifying improved functionality and reduced code smells.&lt;br /&gt;
&lt;br /&gt;
===Relevant Links===&lt;br /&gt;
Github Repository: https://github.com/Naveen-Jayanna/expertiza&lt;br /&gt;
&lt;br /&gt;
===Team Members===&lt;br /&gt;
*Samarth Purushothaman&lt;br /&gt;
&lt;br /&gt;
*Naveen Jayanna&lt;br /&gt;
&lt;br /&gt;
*Arpit Choudhary&lt;br /&gt;
&lt;br /&gt;
===Mentor===&lt;br /&gt;
Aditi Vakeel&lt;/div&gt;</summary>
		<author><name>Njayann</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023&amp;diff=151518</id>
		<title>CSC/ECE 517 Fall 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023&amp;diff=151518"/>
		<updated>2023-11-16T00:17:19Z</updated>

		<summary type="html">&lt;p&gt;Njayann: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Fall 2023 - E2350. Allow reviewers to bid on what to review]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2351. Finish mentor management for assignments without topics]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2352. Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2353. Further refactoring and improvement of review mapping helper]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2355. Improving Search Facility In Expertiza]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2356. Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2357. Refactor sign_up_sheet_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2358. Refactor student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2359. Refactor user_controller.rb, user.rb, and its child classes]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2360. View for Results of Bidding]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2361. Create a page to create and update a Questionnaire in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2362. Create a page to edit an Assignment's due date in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2363. Create a UI for Assignment Edit page &amp;quot;Etc&amp;quot; tab in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2364. Create a UI for Course's &amp;amp; Assignment's &amp;quot;Add Participants&amp;quot; page]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2365. Create a user interface for Questionnaire in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2363. Create a UI for Assignment Edit page &amp;quot;Etc&amp;quot; tab in ReactJS(Phase 2)]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2366. Reimplement assignment model and assignment controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2367. Reimplement participants_controller.rb, participants.rb and its child classes]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2368. Reimplement of due_date.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2369. Reimplement duties controller.rb and badges controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2370. Reimplement join team requests controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2371. Reimplement quiz_questionnaires_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2373. Reimplementation of teams controller]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2373. Reimplement teams_controllers.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2374. Reimplement the Question hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2375. Reimplement Waitlists]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2376. Reimplement student_quizzes_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2379. Reimplement authorization_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2380. Reimplement frontend for Courses]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2382. Optimizing the LatePoliciesController]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2383. Grading Audit Trail]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2384. Reimplement user_controller.rb, user.rb and its child classes]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2385. Create a Courses User interface in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2386. Reimplement teams_users backend]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - E2377. Reimplement impersonating users (functionality within impersonate_controller.rb)]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - NTX-1 Adding Snapshot Controller/API and CRDs]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - NTX-2 Observability and Debuggability]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - NTX-3 Usability and Security]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - NTX-4 Extend NDB Operator capabilities to support Postgres HA]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - G2350. Add GitLab support for using GraphQL to query user metrics 1]]&lt;br /&gt;
* [[CSC/ECE 517 Fall 2023 - G2352. Add GitLab support for using GraphQL to query repository information]]&lt;/div&gt;</summary>
		<author><name>Njayann</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2368._Reimplement_of_due_date.rb&amp;diff=151205</id>
		<title>CSC/ECE 517 Fall 2023 - E2368. Reimplement of due date.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2368._Reimplement_of_due_date.rb&amp;diff=151205"/>
		<updated>2023-11-07T01:25:02Z</updated>

		<summary type="html">&lt;p&gt;Njayann: Updated the test plan section&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;
* 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;
== 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;
=== 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;
=== Calculate Assignment Round ===&lt;br /&gt;
* Scenario: Confirm that the method returns the correct round number based on the response map presence.&lt;br /&gt;
* Edge Case: Test with an invalid assignment id to ensure robustness against unexpected inputs.&lt;br /&gt;
&lt;br /&gt;
=== Copy Due Dates to New Assignment ===&lt;br /&gt;
* Scenario: Check that due dates are accurately duplicated from one assignment to another.&lt;br /&gt;
* Edge Case: Try copying from an assignment with no due dates and ensure the system reacts correctly.&lt;br /&gt;
&lt;br /&gt;
=== Create New DueDate Record ===&lt;br /&gt;
* Scenario: Ensure that a new due date record is created with specified attributes.&lt;br /&gt;
* Edge Case: Try creating a due date with invalid parameters to test the validation process.&lt;br /&gt;
&lt;br /&gt;
=== Get Next Due Date ===&lt;br /&gt;
* Scenario: Validate that the system can retrieve the next due date for an assignment when available.&lt;br /&gt;
* Edge Case: Check retrieval when the next due date is in the past or when there's no subsequent due date.&lt;br /&gt;
&lt;br /&gt;
=== Default Permission Checks ===&lt;br /&gt;
* Scenario: Verify that the system returns default permissions correctly for various deadline types and actions.&lt;br /&gt;
* Edge Case: Examine the behavior when checking permissions for non-existent deadline types.&lt;br /&gt;
&lt;br /&gt;
=== Metareview and Review Permissions ===&lt;br /&gt;
* Scenario: Test that default permissions for metareview and review phases meet the system's expectations.&lt;br /&gt;
&lt;br /&gt;
=== Deadline Right Permission Constants ===&lt;br /&gt;
* Scenario: Confirm that the DeadlineRight module includes accurate default permission constants.&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/samarth-p/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>Njayann</name></author>
	</entry>
</feed>