CSC/ECE 517 Fall 2019 - E1963. Changing assignment participant role

From Expertiza_Wiki
Jump to navigation Jump to search

E1963 Changing assignment Participant role

Background

  • E1963 This project aims to enable the instructor to change the role of an assignment participant. There are two ways to add a new assignment participant, first being through the Add button on the assignment participant page. Another way is to import via a spreadsheet with the list of users that are to be added. The motivation of E1963 was to enable the instructors adding these users using either of the methods mentioned above to change these users' role. A user can have one of the following roles - participant, reader, reviewer, submitter.
  • The existing UI had the a dropdown that displayed the role of the user, we have added a Submit button below each dropdown to enable the instructor to change the role of the user. On tapping the submit button, the role associated with that user is changed in the persistent storage ad a flash message is displayed to the user confirming the change.


The following issues were targeted in this project:

  • #1: The instructor does not have the option to change the role of the user, once he/she has been added to the assignment. Thus, if the instructor wishes to change the role of a user from say a reviewer to a submitter, he/she is not able to save the changes.
  • #2: With the changes made for the issue mentioned above, the instructor will be able to save the changes manually. We would like to maintain the same behavior when the assignment participants are imported from excel. Upon creating a new user using an Excel import, the user should have the role of a participant by default. An instructor was then unable to change the role of the assignment participant.

Navigation

Manage Assignments -> Add new participant 

Current implementation

For each of the assignment participant record, there is a dropdown which contains the role of the participant. When the instructor attempts to change the value in the dropdown, it is not reflected in the backend, as there is no call associated with it, to submit the changes. Thus when the user revisits the page, the changes would he would have made are not retained.

Authorization of the user is based on the flags can_submit, can_review and can_take_quiz flags, which are set to be true or false based on the role of the user. By default, the user is assigned the role of a participant in any assignment. Thus, the goal is to modify these flags and save them in the database when the role of the assignment participant is changed, so that it is a persistent change. Authorization of the users based on the flags can be deduced as follows:

  • Participant has can_submit=true, can_review=true and can_take_quiz=true
  • Reader has can_submit= false, can_review=true and can_take_quiz= true
  • Submitter has can_submit=true, can_review= false and can_take_quiz=false
  • Reviewer has can_submit=false, can_review= true and can_take_quiz=false


Problems:

  • 1. There is no way to change the role of the user, once the user has been added to the assignment as a participant.
  • 2. Instructor is not given any confirmation that the role of the participant has been reverted to the original value once he/she navigates somewhere else. This is misleading for an instructor as the he/she might be under the impression that the changes he/she made have been saved.


Snapshots depicting the issue

  • As an Instructor, go to Manage Assignments




  • Click on add participant




  • Note that the user on the first record is currently a "Reader"




  • Change the role of the "Reader" to say "Submitter"




  • Refresh or re-navigate to this page and note that the changes are reverted




Implementation

Changes are made in the partial for participants "_participant.rb", so that the submit button is rendered on the view. Upon changing the selected value for the user role, 'update_authorizations' method is called from participants controller which passes the participant id as a parameter to the method to change it's role in the database. The selected role is passed as a parameter 'authorization' to the update authorization method that updates the can_submit, can_take_quiz, and can_review flags appropriately for each role as described above for the selected participant id.

Implementing the above mentioned changes, allows the instructor to change the value of role in the dropdown which retains the corresponding record on tap of the Submit button. We have verified that the changes in the above mentioned flags are reflected in the database. The instructor will be presented with a success message on changing the role of the selected participant, on clicking submit. The instructor can revisit the page and expect the updated value to be retained. Both the problems listed above are taken care of such as the instructor is facilitated with an option to change the participant, as well as knows that the change made will be durable.

Snapshots after the changes

  • Submit button has been added to each row of assignment participants




  • Change the "Reader" to "Submitter", on the first record and click on submit. Changes have been persisted.





Additional Changes

In addition to the above-mentioned issue, we fixed a few other issues that we encountered relevant to Assignment Participant and Course Participant Controllers, namely:

1. Export Details in Assignment Participants view: We noticed that a a blank csv file was getting generated from Manage Assignments. We discovered that the reason for this issue is that in the import method, the model defined was that of AssignmentParticipant whereas all the parsing methods for export were present in Assignment model. We did the required changes, tested the functionality and note that this is working fine now. The changes for this are made in the common module - export_file_controller.rb following which the export and export_details methods are now called from the assignment.rb as opposed to assignment_participant.rb where there are no export methods and their corresponding implementations. Now, the Export Detail button generates a comma-seperated file with the following headers:

  • Assignment Name
  • Assignment Instructor
  • Team ID / Author ID
  • Reviewee (Team / Student Name)
  • Reviewer
  • Question / Criterion
  • Question ID
  • Answer / Comment ID
  • Answer / Comment
  • Score

2. "Import Assignment Participants" was not working - It is expected that if a user does not exist in the system, on importing assignment participants, a user will be created and he/she will be added to the assignment as a participant. With the current implementation, the user was getting created, however corresponding AssignmentParticipant was not getting created due to a validation with respect to handle. We have fixed this issue by setting the handle in AssignmentParticipants to be the same as the full name of the user created (in accordance with the current functionality - when a user is added as an AssignmentParticipant from the UI). This facilitates us to import AssignmentParticipants.

Test Plan

Rspec test have been added to check the update authorizations functionality in the participants_controller_spec.rb to verify the change of flags as per the authorization of the user whether the expected flash message is visible on the UI.

Team

  1. Natansh Negi (nnegi2@ncsu.edu)
  2. Richa Dua (rdua2@ncsu.edu)
  3. Roshani Narasimhan (rnarasi2@ncsu.edu)

Mentor: Sharique Khan (mkhan8@ncsu.edu)

References