CSC/ECE 517 Fall 2023 - E2358. Refactor student quizzes controller.rb

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Student Quizzes are quizzes students create after the submission of their assignment on Expertiza application. Student quizzes can consist of multiple answered checkbox questions, classic multiple choice questions and true false questions. The number of questions that can should be on the quiz is predetermined by the instructor when the assignment is created. Unfortunately due to a decision that is made during Spring Semester 2023, quiz function is eliminated from Expertiza, the web portal was not functional. Nevertheless the existing code was refactored according to the previous comments and tests has been completed with Rspec.

New Files

  1. spec/controllers/student_quizzes_controller_spec.rb

File Changes

  1. app/controllers/student_quizzes_controller.rb


Test Plan

When the project was pulled from the main repository, test plans were not previously present for student_quizzes_controller.rb. Within the scope of TDD research, we have opted to have the test skeletons by Mustafa Olmez, which has given us a very good idea on the tests that should be integrated for our unit. 29 of the test skeletons were integrated into the our work allowing us to test the controller profoundly. The complete file can be found here:
https://github.com/expertiza/expertiza/pull/2656/files#diff-06772dc7cd41f4d09fb403ddcc22137ade6308cb87ec53d82bf7664300c4eef7
We found that a factory already existed for student quizzes. Much of the work previously found in the quiz_factory was incorporated into the RSpec controller tests.

Modifications

The following modifications have been made on app/controllers/student_quizzes_controller.rb

  • Following comments have been added to calculate_score:
    • "valid" boolean is turned to valid_flag in order to emphasize it is a flag for checking validity of the answer
    • questionnaire has been refactored into quiz emphasize it's usage in the program.
    • ques_type is refactored into question_type for extra clarity
    • new_score is refactored into each_answer_score to clarify its specific usage
  • Following comments have been added to calculate_score:
    • response has been refactored to participant_response
    • questions has been refactored to quiz_questions
    • Additional comment for the usage of reponse is added, clarifying the previous comment asking about its usage.
  • Explanatory comments have been added to self.take_quiz since previous feedback stated its usage was unclear.
  • Grammatically incorrect comments have been corrected throughout the document.

Some of the requested comments from the project description were outdated and/or already updated. Please check our Github page for further comments. https://github.com/SteveEaston/expertiza

Results

For our project we have managed to correct or respond all of the addressed concerns given to us in our project description. Furthermore by using the test skeletons given to us we have managed to test conduct thorough unit testing for our controller.

The following pull request was found among in the main repository of Expertiza, which shows the quiz functionality was discontinued and removed from expertiza.

https://github.com/expertiza/expertiza/pull/2340

Due to the function being discontinued we have not been able to observe the functionality directly on Expertiza itself, nevertheless using the wide range of test skeletons provided to us we have managed to ensure the module would be up and running when and if the integration issues were to be resolved.


Team

Rain Bayraktar <ybbayrak@ncsu.edu>
Steve Easton <sleaston@ncsu.edu>
Scott Hardin <shardin2@ncsu.edu>

Pull Request

Changes for this project are under Expertiza Pull Request https://github.com/expertiza/expertiza/pull/2656