CSC/ECE 517 Spring 2021 - E2110. Regulate changing of rubrics while projects are in progress: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 98: Line 98:
* Added in_active_period() call to display warning about edited questionnaire during active period
* Added in_active_period() call to display warning about edited questionnaire during active period
* Added confirm: to submit_tag 'Add' to display confirmation popup when adding a question during active period
* Added confirm: to submit_tag 'Add' to display confirmation popup when adding a question during active period
* Added script to catch <a> tag redirects with [data-method="delete"] to display popup when removing a question during active period.
* Added script to catch <a> tag redirects with [data-method="delete"] to display popup when removing a question. Script only active if in active period.


=== app/views/mailer/notify_review_rubric_change.html.erb ===
=== app/views/mailer/notify_review_rubric_change.html.erb ===

Revision as of 16:44, 29 April 2021

Members

  • Nicholas Himes
  • Surya Makthal
  • Jordan Boerger
  • Sai Krishna Wupadrashta Dhinakara Subrahmanya

Project Description

While setting up an assignment, the instructor will be asked to choose different kinds of rubrics. Any of these rubrics can later be edited or changed to a different rubric. A problem arises when an assignment is underway (students have already started reviewing) and a rubric is edited or changed. Some students started reviewing with the old rubric and the rest of the students who had not started a review will be presented with the updated rubric. This usually happens when an assignment is copied from a previous year and the rubrics are not updated to match the current topic. It could be at a later point that the instructor/TA realizes this and changes it.

Goal

If the instructor does edit or change a rubric while an assignment is in progress:

  • If the change affects only the wording of a particular rubric item (e.g., to clarify the statement), no action is necessary.
  • If a rubric is replaced, or the items/questions are changed, then all the reviews that have been done need to be redone. The system should then email the previously done reviews to the reviewer and delete the response object and all associated answer objects. (However, the response_map should not be changed.)


This project was done in Fall 2019. However, it was not tested thoroughly. Our team's work in Spring 2021 is to improve the testing and readability of the code.

Design Diagrams

Use Case Diagrams

*Using UML Use Case Diagram Syntax

Data Flow Diagrams

Note: This data flow diagram was originally made by the team from project E1982 in Fall 2019. Their wiki link can be viewed here:

https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Fall_2019_-_E1982._Regulate_changing_of_rubrics_while_projects_are_in_progress

Proposed Solution

We will write comprehensive tests and fix any bugs in the code written already for changing rubrics while projects are in progress.

Some known issues already have been identified:

  • Email functionality needs to be thoroughly tested
    • Currently, only tested for correct arguments
  • The method find_review_period is possibly redundant as Find deadlines does exist already in the code. This method needs to be replaced/removed if possible
  • A method comment is needed on in_active_period method in answer_helper.rb
  • Tests need to be more thorough and verify that correct rows are being deleted for delete_existing_responses function in answer_helper.rb
  • Split delete_existing_responses into more functions as it's complexity is reletively high
    • Contains some nested loops so these should be removed
  • Confirm changes do not affect students who have not yet submitted their reviews by doing UI testing
  • Line-by-line comments are needed for all added functions

Flow

The main actions this project affects are adding and removing questions from a questionnaire. These diagrams will show how these events now occur. Because these events are handled differently in Expertiza, the implementation is slightly different for both cases.

*Note: As you can see in the diagrams below, the confirmation popup is thrown in different ways for "Add" vs "Remove". This is because in _questionnaire.html.erb:

"Add" is implemented as a submit_tag which can easily have a confirm: attribute added to it causing it to throw a popup within expertiza.

"Remove" is an <a> tag hyperlink rendered to the page by line <%=question.edit(i)%> which iterates through all questions in the questionnaire and renders their edit() functions. Edit() is a function in each question types model (criterion.rb, cake.rb, etc.). Edit() adds lines to the html for each field in the question table, including the "Remove" link. The "Remove" hyperlink has an href attribute which dynamically links to /questions/ + self.id.to_s based on the desired questions id. It then uses a data-method="delete" attribute to select the destroy method in questions_controller.rb. Because this hyperlink exists in each question types model, it is hard to implement a clean solution which does not edit all the model files. To do this, we added a short <script> to the end of _questionnaire.html.erb which scans for <a> hyperlink redirects with the [data-method="delete"] attribute and throws a popup within the browser rather than expertiza. This popup works the same as the "Add" popup. The script returns the result (true/false) of this popup to the <a> tag. In html, the redirect is cancelled if a false is returned to the tag and continues if a true is returned.

Adding question during active period Removing question during active period

Documentation

Here is a list of files and the functions that were added or edited

app/helpers/answer_helper.rb

Helper module containing important functions for deletion of responses and answers when editing a questionnaire during review period

  • delete_existing_responses(question_ids, questionnaire_id)
  • log_answer_responses(question_ids, questionnaire_id)
  • log_response_info(response_ids)
  • review_mailer(email, answers, name, assignment_name)
  • review_mailer(email, answers, name, assignment_name)
  • delete_answers(response_id)
  • in_active_period(questionnaire_id, answer=nil)

app/controllers/questionnaires_controller.rb

  • add_new_questions

app/controllers/questions_controller.rb

  • destroy

app/mailers/mailer.rb

  • notify_review_rubric_change(defn)

app/models/assignment.rb

  • find_review_period(round)

app/models/assignment_questionnaire.rb

  • get_latest_assignment(questionnaire_id)

app/views/questionnaires/_questionnaire.html.erb

  • Added in_active_period() call to display warning about edited questionnaire during active period
  • Added confirm: to submit_tag 'Add' to display confirmation popup when adding a question during active period
  • Added script to catch <a> tag redirects with [data-method="delete"] to display popup when removing a question. Script only active if in active period.

app/views/mailer/notify_review_rubric_change.html.erb

  • New file containing email layout used when emailing students their answers after questionnaire is edited during active period.

Changed Files

  • Added:
    • app/helpers/answer_helper.rb
    • app/views/mailer/notify_review_rubric_change.html.erb
  • Edited:
    • app/controllers/questionnaires_controller.rb
    • app/controllers/questions_controller.rb
    • app/mailers/mailer.rb
    • app/models/assignment.rb
    • app/models/assignment_questionnaire.rb
    • app/views/questionnaires/_questionnaire.html.erb
  • Test Case Files
    • spec/controllers/questionnaires_controller_spec.rb
    • spec/models/assignment_spec.rb
    • spec/controllers/questions_controller_spec.rb
    • spec/helpers/answer_helper_spec.rb

Test Plan

As stated above, we will need to create thorough tests for the following files:

  • spec/controllers/questionnaires_controller_spec.rb
  • spec/models/assignment_spec.rb
  • spec/controllers/questions_controller_spec.rb
  • spec/helpers/answer_helper_spec.rb