CSC/ECE 517 Sping 2023 - E2322: Refactor Questionnaire View to display Bookmark Rating: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 35: Line 35:


By removing this unused code, we can simplify the codebase and improve the maintainability of the application, as well as potentially reduce the size of the project and improve its performance.
By removing this unused code, we can simplify the codebase and improve the maintainability of the application, as well as potentially reduce the size of the project and improve its performance.
=====Refactor Questionnaire Type Node=====
The file questionnaire_type_node.rb servers as a template for all the questionnaire nodes which handles the folders list of questionnaires of various types. we have refactored by creating a helper method for the return_nodes_list, which returns a list of folder nodes for the corresponding list of folders.


== Testing  Plan ==
== Testing  Plan ==

Revision as of 23:44, 22 March 2023

Expertiza

Expertiza is a Ruby on Rails based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on a different projects and assignments and submit their work. They can also review other students' submissions.

Questionnaires Controller

Questionnaire is the superclass for all types of questionnaires and rubrics. We can create, display, and manage questionnaires using this controller. Expertiza allows users to create a variety of questionnaires, including reviews, metareviews, teammate reviews, assignments, global surveys, course surveys, and bookmark ratings.

Problem Statement

The following tasks were accomplished in this project:

  • Refactoring the methods doing multiple tasks and breaking them in different modules.
  • Refactoring duplicate code into a single method.
  • Add comments to methods and complex lines of code.
  • Removing code that is no longer being used or required
  • Try to fix issues from Code Climate.

Files Modified

Below are the files we changed as part of refactoring

Bookmarks Controller

This is the bookmarks_controller.rb which handles all the CRUD operation performed on bookmarks. Multiple things were done in just one method which we broke in modules doing that specific task. We have the same code repeating in multiple places which we moved into a single method.

Questionnaire Node
Questionnaire Type Node

In the file app/models/questionnaire_type_node.rb which handles and defines the structure of the questionnaire Node template. we have refactored by creating a helper method for the return_nodes_list, which returns a list of folder nodes for the corresponding list of folders.

Refactoring

Refactor Bookmark Controller

The file that is no longer being used in project and was written long ago to add bookmark functionality can be considered as "dead code". And the bookmark functionality that was originally implemented in this file has been moved to another file in the project, making the original file redundant. To address this issue, the dead code in the form of the original file can be safely removed from the project.

By removing this unused code, we can simplify the codebase and improve the maintainability of the application, as well as potentially reduce the size of the project and improve its performance.

Refactor Questionnaire Type Node

The file questionnaire_type_node.rb servers as a template for all the questionnaire nodes which handles the folders list of questionnaires of various types. we have refactored by creating a helper method for the return_nodes_list, which returns a list of folder nodes for the corresponding list of folders.

Testing Plan

Testing From UI

  • View Bookmark Rating Before creation
  1. After logging in as instructor, go to Manage > Questionnaires.
  2. Initially there will be no bookmarks rating.
  3. Click on the Bookmark Rating, there wont be a dropdown as there are no ratings.
  • Create new Bookmark Rating
  1. As an instructor, go to Manage > Questionnaires,
  2. In bookmark Rating field, click on plus button.
  3. Create a new Bookmark Rating with required details.
  4. After creating Bookmark Rating, Start adding questions.
  • View Bookmark Rating After creation
  1. After logging in as instructor, go to Manage > Questionnaires.
  2. Click on the Bookmark Rating, there will be a dropdown with list of Bookmark Ratings.

Automated Testing with RSpec

For most of our changes we did not have to create new test cases or modified exiting test cases for all the functionalities that we have been modifying. After refactoring we run the test cases in respective files.

Below is the screenshot of the result after running the test cases.

Team

Mentor
  • Kartiki Bhandakkar
  • Divyang Doshi
Members
  • Mithila Reddy Tatigotla, mtatigo
  • Vineeth Dasi, vdasi
  • kalyan Karnati, kkarnat

References

  1. Expertiza
  2. Expertiza GitHub
  3. Pull Request to Merge
  4. Deployed Changes Userid - instructor6 and Password - password
  5. GitHub Project Board