CSC/ECE 517 Fall 2021 - E2130. Refactor submitted content controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
== Testing Requirements ==
== Testing Requirements ==


=== Steps to test the submitted_content_controller ===
== Steps to test the submitted_content_controller ==


1. git clone https://github.com/Neelkanth7/expertiza
1. git clone https://github.com/Neelkanth7/expertiza
2. Change directory to expertiza. Run "bundle install" and rails db:migrate.
2. Change directory to expertiza. Run "bundle install" and rails db:migrate.
3. Start the rails server.
3. Start the rails server.
4. Run the following command in a new terminal of the expertiza directory:  
4. Run the following command in a new terminal of the expertiza directory:  
     i.  rspec spec/controllers/submitted_content_controller_spec.rb
     i.  rspec spec/controllers/submitted_content_controller_spec.rb

Revision as of 21:57, 20 October 2021

E2130: Refactor 'submitted_content_controller' Controller

This page provides detailed explanation of the Submitted Content Controller which is a part of the Expertiza project. The aim of the project is to refactor the 'submitted_content_controller', which contains the methods to submit assignment related information such as submit & remove hyperlinks, files and other relevant information that could be part of the assignment. It also handles views based on the user roles and permissions they have. The project involved refactoring some parts of the controller to incorporate the OODD principles so that the readability of code could be improved.

About Expertiza

The Expertiza platform employs a divide-and-conquer strategy for creating reusable learning objects via active-learning exercises built entirely on Ruby on Rails framework. Students get to choose from a list of tasks to complete either individually or in teams. They then prepare their work and submit it to a peer-review mechanism. On submission, other students can assess their peers work and provide feedback. Expertiza encourages students to collaborate in order to improve the learning experiences from one another. It aids their learning by making them translate what is taught in the lectures and apply those concepts to a real-world issue.

Problem Statement

submitted_content_controller had some problems that violate essential rails design principles which needed to be rectified. Issues included some methods being too long which needed to be broken down, a few methods needed better naming and a few that were no longer needed.

Broadly, the following issues were addressed as a part of refactoring this controller:

  • Renaming methods to more appropriate and functionality specific names.
  • The existing code was reused to perform either the same function or re-purposed to do a similar adhering to standards and improving overall quality of the code.
  • Introduction modular making each module easier to understand, test and refactor independently of others.

Testing Requirements

Steps to test the submitted_content_controller

1. git clone https://github.com/Neelkanth7/expertiza

2. Change directory to expertiza. Run "bundle install" and rails db:migrate.

3. Start the rails server.

4. Run the following command in a new terminal of the expertiza directory:

   i.  rspec spec/controllers/submitted_content_controller_spec.rb

References

  • Github link to the project.
  • Link to the project description.