CSC/ECE 517 Fall 2022 - E2275. Further refactoring and improvement of student quizzes controller: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
==Expertiza Overview==
==Expertiza Overview==
Ruby on Rails was used to create Expertiza, a multifunctional online application for instructors and students. Instructors using Expertiza have the ability to design their own teams, classes, assignments, quizzes, and much more. However, students are also permitted to work in groups, take tests, and do tasks. Additionally, Expertiza enables students to share peer reviews, allowing them to collaborate to enhance others' learning opportunities. It is an open-source program, and Expertiza is in Github repository [https://github.com/expertiza/expertiza Expertiza].
Ruby on Rails was used to create Expertiza, a multifunctional online application for instructors and students. Instructors using Expertiza have the ability to design their own teams, classes, assignments, quizzes, and much more. However, students are also permitted to work in groups, take tests, and do tasks. Additionally, Expertiza enables students to share peer reviews, allowing them to collaborate to enhance others' learning opportunities. It is an open-source program, and Expertiza is in Github repository [https://github.com/expertiza/expertiza Expertiza].
==Prior Work==
<ul>
<li>Modified and added comments for index function to clearly indicate it’s functionality</li>
<li>Refactored the calculate_score method and moved to helper method. which helped in increasing the readability and maintainability of the code while being constant with object oriented design principles. </li>
<li>In the finished_quiz function, renamed the variables to help understand their purpose better.</li>
<li>@quiz_taker = AssignmentTeam.find(@quiz_response_map.reviewee_id).participants.first
This line of code seems to assume that only one person is on the team. Therefore, changed the name of the variables to better indicate their purpose. </li>
<li> For self.take_quiz, as the method comment is correct, the name of the method was changed to something relating to what tasks it performs as what it does is not particularly clear.</li>
<li>The name and the comments for the function were improved to describe the functionality better.</li>
<li> IMehtods that were for quiz_questionnaires were moved to quiz_questionnaire.rb?? </li>
<li>The comment were grammatically incorrect. Therefore, fixed the English in the comment. </li>
</ul>


==Problem Statement==
==Problem Statement==
Line 23: Line 36:
Many of these proposed changes require moving the function somewhere else, so some tests may break and require being moved or targeting a different file. Additionally, this file has very little coverage, so manual verification may be required.
Many of these proposed changes require moving the function somewhere else, so some tests may break and require being moved or targeting a different file. Additionally, this file has very little coverage, so manual verification may be required.


==Prior Work==
==Github and Related Link==
<ul>
Github repository corresponding to this task is publicly available at [https://github.com/WeiRui-Wang/expertiza E2151 GitHub].
<li>Modified and added comments for index function to clearly indicate it’s functionality</li>
 
<li>Refactored the calculate_score method and moved to helper method. which helped in increasing the readability and maintainability of the code while being constant with object oriented design principles. </li>
Github pull request and file changes can be viewed at [https://github.com/expertiza/expertiza/pull/2150/files E2151 Pull Request].
<li>In the finished_quiz function, renamed the variables to help understand their purpose better.</li>
 
<li>@quiz_taker = AssignmentTeam.find(@quiz_response_map.reviewee_id).participants.first
Github of source code of externally hosted bidding algorithm service deployment manual and files can be access at [https://github.com/uahamedncsu/IntelligentAssignment IntelligentAssignment].
This line of code seems to assume that only one person is on the team. Therefore, changed the name of the variables to better indicate their purpose. </li>
 
<li> For self.take_quiz, as the method comment is correct, the name of the method was changed to something relating to what tasks it performs as what it does is not particularly clear.</li>
==Contributors==
<li>The name and the comments for the function were improved to describe the functionality better.</li>
===Mentor===
<li> IMehtods that were for quiz_questionnaires were moved to quiz_questionnaire.rb?? </li>
Neha Kotcherlakota (nkotche@ncsu.edu)
<li>The comment were grammatically incorrect. Therefore, fixed the English in the comment. </li>
===Team Members===
</ul>
Priyam Swatil Shah (pshah9@ncsu.edu)<br>
Sanay Yogesh Shah (sshah34@ncsu.edu)<br>
Subodh Gujar (sgujar@ncsu.edu)

Revision as of 22:30, 12 November 2022

Expertiza Overview

Ruby on Rails was used to create Expertiza, a multifunctional online application for instructors and students. Instructors using Expertiza have the ability to design their own teams, classes, assignments, quizzes, and much more. However, students are also permitted to work in groups, take tests, and do tasks. Additionally, Expertiza enables students to share peer reviews, allowing them to collaborate to enhance others' learning opportunities. It is an open-source program, and Expertiza is in Github repository Expertiza.

Prior Work

  • Modified and added comments for index function to clearly indicate it’s functionality
  • Refactored the calculate_score method and moved to helper method. which helped in increasing the readability and maintainability of the code while being constant with object oriented design principles.
  • In the finished_quiz function, renamed the variables to help understand their purpose better.
  • @quiz_taker = AssignmentTeam.find(@quiz_response_map.reviewee_id).participants.first This line of code seems to assume that only one person is on the team. Therefore, changed the name of the variables to better indicate their purpose.
  • For self.take_quiz, as the method comment is correct, the name of the method was changed to something relating to what tasks it performs as what it does is not particularly clear.
  • The name and the comments for the function were improved to describe the functionality better.
  • IMehtods that were for quiz_questionnaires were moved to quiz_questionnaire.rb??
  • The comment were grammatically incorrect. Therefore, fixed the English in the comment.

Problem Statement

Background

The student_quizzes_controller consists of methods involved in creating, scoring & recording responses of the quizzes taken by reviewers or students of the other teams with the same assignment. This controller has some issues that violate essential Rails design principles such as DRY principle. There are few methods in this controller that should have been in model classes. Some methods share code, which creates code repetition. Some method comments need to be rewritten.

Resources

Resource 1 :- https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2016/Refactor_different_question_types_from_quiz_feature
Resource 2 :- https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2014/oss_E1460_aua
Resource 3 :- https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2022_-_E2255._Refactor_student_quizzes_controller.rb

Required Changes

This project builds on E2225, and should begin with the refactoring done by that project. That project focused on simplifying the methods instudent_quizzes controller, while this project looks at making the code more understandable and transparent.

  • Method ‘calculate_score’ was moved to the helper completely. Although, the expectation is to retain the redirection logic in the controller and move the business logic to the helper function.
  • Method ‘review_questions’ contains the logic for quiz questionnaire. It makes more sense for it to be moved to the quiz_questionnaire controller instead.
  • Method ‘calculate_score’ contains logic that is similar to the compute_weighted_score method in the quiz_questionnaire.rb. Refactor the logic of the method to leverage the existing implementation and eliminate duplicate code.
  • Utilize the logic in method ‘validate_question’ from the quiz_questionnaire.rb in the calculate_score method instead of the multiple if else statements.

Because this is simply a refactoring project, no functionalities should change. Therefore, existing tests should still pass after these changes have been completed. To test this controller, create a new rspec file for student_quizzes_controller.rb and run the following commands to verify your changes do not break any core functions.
rspec spec/controllers/student_quizzes_controller_spec.rb
Many of these proposed changes require moving the function somewhere else, so some tests may break and require being moved or targeting a different file. Additionally, this file has very little coverage, so manual verification may be required.

Github and Related Link

Github repository corresponding to this task is publicly available at E2151 GitHub.

Github pull request and file changes can be viewed at E2151 Pull Request.

Github of source code of externally hosted bidding algorithm service deployment manual and files can be access at IntelligentAssignment.

Contributors

Mentor

Neha Kotcherlakota (nkotche@ncsu.edu)

Team Members

Priyam Swatil Shah (pshah9@ncsu.edu)
Sanay Yogesh Shah (sshah34@ncsu.edu)
Subodh Gujar (sgujar@ncsu.edu)