CSC/ECE 517 Fall 2023 - E2351. Finish mentor management for assignments without topics: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(35 intermediate revisions by 3 users not shown)
Line 3: Line 3:
* Kyle Pichon
* Kyle Pichon
* Helen Solomon
* Helen Solomon
* Erik Lopez-Godinez
* Erik Lopez-Godinez (Phase 1)
* Basaveswara Mukesh Suryadevara (Final Phase)
'''Mentor''' <br/>
'''Mentor''' <br/>
* Dr. Ed Gehringer <br/>
* Dr. Ed Gehringer <br/>
== Problem Statement ==
The previous team, [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics Project E2115], implemented the mentor_management.rb file which completed tasks such as auto assigning a mentor if the assignment chose to have that capability when the team is >50% full and also emailing the chosen mentor. It also implemented the methods of the mentor_management.rb in other files so that when the team surpassed 50% through inviting team members that a mentor was automatically assigned. The previous team implemented a lot for the new mentor duty that was planned to be added but they did not make a way to assign mentors, not through the UI or import so the changes they made could not be properly implemented. That is why our team was tasked with creating those changes in the UI and import so that participants could be made into mentors. Once we were able to have their changes be made there were some other things that needed to be changed.
*Their algorithm was not properly balancing the mentor in terms of the amount of teams they would mentor.
*We also noticed that when mass creating teams automatically it would not auto-assign mentors.
* We also added changes to the users team members table so that the mentor is identifiable since perhaps in the future their would be a specific review for the mentor which would not be the same for if reviewing another student.
*We also added a new view for the mentor since the Your Team view would only show the first team and mentors would be on multiple so we would need to display all their teams.
== Design Document (Final Phase) ==
For the second half of this project, a refactoring of the first half is needed. There are 4 key points that will be addressed during this refactoring to clean up the code related to the automatic mentor management system for assignments that have it enabled.
1) Discard changes related to import functionality. This will be handled by a different project and entangling mentor management into it would add unneeded complexity to that future project when standard import then swapping a user to be a mentor from the UI would suffice for now.
2) Make sure that for every scenario in which a team user is created and added to a team, that a single method call is used.
3) Change the duty field of participants to be a boolean flag more in line with the can_review, can_submit, etc. flags that are used for other permissions. This was initially avoided because it will require a database migration but after reviewing how this choice complicated the code, this solution has been deemed more appropriate. It will be called can_mentor and all current checks in the code for :duty == 'mentor' will be exchanged for :can_mentor to replicate functionality.
4) Create a subclass of AssignmentTeam called MentoredTeam that will have overridden methods that loop-in the MentorManagement workflows where appropriate.
Beyond this general improvements of the code such as redoing comments to be much more detailed and fixing some method names to better represent what they actually do.


== User Credentials ==
== User Credentials ==
Line 17: Line 41:


== Description of the current project ==
== Description of the current project ==
First Demo -- https://youtu.be/WqBjv5Sluxg <br>
Second Demo (Final Phase) -- https://youtu.be/wsTzlgR3oWs <br>
'''VCL Instance''' -- http://152.7.178.198:8080


E2351 is an Expertiza based OSS project that handles the relationship between mentors, teams, and assignments. The ability to assign mentors with topics is implemented but lacked the ability to manage mentors for assignments without topics. Some refactoring within the assignment logic from the remnants of [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics Project E2115] allowed us to accomplish some of our objectives.
E2351 is an Expertiza based OSS project that handles the relationship between mentors, teams, and assignments. The ability to assign mentors with topics is implemented but lacked the ability to manage mentors for assignments without topics. Some refactoring within the assignment logic from the remnants of [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics Project E2115] allowed us to accomplish some of our objectives.
== Problem Statement ==
The previous team, [https://wiki-expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2115._Mentor_management_for_assignments_without_topics Project E2115], implemented the mentor_management.rb file which completed tasks such as auto assigning a mentor if the assignment chose to have that capability when the team is >50% full and also emailing the chosen mentor. It also implemented the methods of the mentor_management.rb in other files so that when the team surpassed 50% through inviting team members that a mentor was automatically assigned. The previous team implemented a lot for the new mentor duty that was planned to be added but they did not make a way to assign mentors, not through the UI or import so the changes they made could not be properly implemented. That is why our team was tasked with creating those changes in the UI and import so that participants could be made into mentors. Once we were able to have their changes be made there were some other things that needed to be changed.
*Their algorithm was not properly balancing the mentor in terms of the amount of teams they would mentor.
*We also noticed that when mass creating teams automatically it would not auto-assign mentors.
* We also added changes to the users team members table so that the mentor is identifiable since perhaps in the future their would be a specific review for the mentor which would not be the same for if reviewing another student.
*We also added a new view for the mentor since the Your Team view would only show the first team and mentors would be on multiple so we would need to display all their teams.


== Objectives ==  
== Objectives ==  
Line 36: Line 55:
*Adding a new view for the mentor to view all the teams they are currently mentoring for the assignment
*Adding a new view for the mentor to view all the teams they are currently mentoring for the assignment


== Files modified in current project and the UI Changes==
== Files modified in phase 1 and the UI Changes==
=== Enable the UI to be able to assign mentors role/duty to participant ===
=== Enable the UI to be able to assign mentors role/duty to participant ===
1. app/controller/particpants_controller.rb (Update to take into account duty) <br/>
1. app/controller/particpants_controller.rb (Update to take into account duty) <br/>
Line 76: Line 95:


== Changes made ==
== Changes made ==
1. app/controller/particpants_controller.rb (Update to take into account duty) <br/>
1. [[File:Screenshot 2023-10-29 232606.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/9344caee2def2baac1278965424c5cf56aa8aff2 app/controller/participants_controller.rb] <br/> Permission definitions are altered to include 'can_mentor' within Participant Controller to indicate duty of participant.]]
[[File:Screenshot 2023-10-29 232606.png|thumb|center|520px|]]
 
2. [[File:Participants helper changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/9344caee2def2baac1278965424c5cf56aa8aff2 app/helpers/participants_helper.rb] <br/> Permission setting is altered to include 'can_mentor' within Participant Controller to indicate duty.]]
 
3. [[File:Models assignment changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/9344caee2def2baac1278965424c5cf56aa8aff2 app/models/assignment.rb] <br/> Making sure to account for duty of participant when being added to an assignment.]]
 
4. [[File:Models participant changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/9344caee2def2baac1278965424c5cf56aa8aff2 app/models/participant.rb] <br/> Adding an additional authorization that is acquired from permissions set for participant.]]
 
Changes 1-4 were done to update the creation of participants to account for the duty field that was added by the previous mentor management group to enable filtering for mentors. The filtering requires that when a participant has the duty field filled with a string matching "mentor" but this functionality was not present. These changes fix this oversight.
 
 
5. (Drop down UI)(Updated the table to diplay current duty so a mentor is easily identifiable in the table) <br/>
 
::a) [[File:Views particpants participant changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/9344caee2def2baac1278965424c5cf56aa8aff2 (1)  app/views/participants/_participant.html.erb] <br/> Add the drop-down option for '''mentor''' and define set of permissions for role.]]
 
::b) [[File:Cont views particpants participant changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/1d7a520ccd38235937c9839988fb6e2fdcc50fac (2) app/views/participants/_participant.html.erb] <br/> Update to take into account duty]]
 
::c) [[File:Cont views participants participant.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/677c8c1ea6ef763254f778f706f317ffe8ca92f5 (3) app/views/participants/_participant.html.erb] <br/> Adding duty column to participants.]]
 
6. [[File:Views sharedScripts userList.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/677c8c1ea6ef763254f778f706f317ffe8ca92f5 app/views/shared_scripts/_user_list.html.erb] <br/> Shows participants duty header for the column]]
 
 
7. [[File:Views sharedscripts addIndividual changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/80f9fb14b5d11e0d928514fc4684c806ec2d3812 app/views/shared_scripts/_add_individual.html.erb] <br/> Updated the singular import of a user to be able to import them as mentor]]
 
Changes 5-7 were the general UI fixes needed to show the mentor in the participants list allow for a participant to be individually added by user id already as a mentor, and allow for any participants permissions be changed to mentor from the already present dropdown. Visuals highlighting these changes are visible in the above section.
 
8. [[File:Screenshot 2023-10-30 002612.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/80f9fb14b5d11e0d928514fc4684c806ec2d3812 app/controllers/import_file_controller.rb] <br/> Added new param for the duty/role]]
 
9. [[File:Views import file participant changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/80f9fb14b5d11e0d928514fc4684c806ec2d3812 app/views/import_file/_participant.html.erb] <br/> Updated table to account for duty]]
 
10. [[File:Views participants links changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/80f9fb14b5d11e0d928514fc4684c806ec2d3812 app/views/participants/_links.html.erb] <br/> Updated expected fields to expect the new duty column]]
 
11. [[File:Models assignmentParticipant changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/a6072fae7060be33294c80413cdb2559fdb2d279 app/models/assignment_participant.rb] <br/> Updated the amount of expected items since duty is added and how a AssignmentParticipant is created]]
 
Changes 8-11 are focused around the mass import functionality and adapting it to work with auto mentor assignment. The preview view after importing file needed an additional column to show the duty field of the participants, and the importing of files without headers needed an additional expected parameter to be added to also account for duty.
 
 
12. [[File:Models mentor changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/1d7a520ccd38235937c9839988fb6e2fdcc50fac app/models/mentor_management.rb] <br/> Adjusting the balancing algorithm.]]
 
Change 12 is fixing the balancing algorithm so each mentor will have almost the same number of teams as all other mentors on the assignment. The previous implementation was giving a single mentor to every group. An incorrect query was being done, and fixing this was the only issue needed to be resolved for full functionality.
 
13. [[File:Controllers teamUsersController.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/6f09a7a781a8adee06b3d942ff62a8277da76ff9 app/controllers/teams_users_controller.rb] <br/> Fixed auto team creation with auto_mentor.]]
 
14. [[File:Models invintation changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/6f09a7a781a8adee06b3d942ff62a8277da76ff9 app/models/invitation.rb] <br/> Fixed auto team creation with auto_mentor.]]
 
15. [[File:Models team changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/6f09a7a781a8adee06b3d942ff62a8277da76ff9 app/models/team.rb] <br/> Fixed auto team creation with auto_mentor.]]
 
16. [[File:Models teamUser changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/6f09a7a781a8adee06b3d942ff62a8277da76ff9 app/models/teams_user.rb] <br/> Fixed auto team creation with auto_mentor.]]
 
Changes 13-16 are about propagating the auto_assign_mentor functionality to the areas highlighted by the previous group that they were supposed to target. #16 shows a method added teams_user that loops in the mentor management check immediately after adding a user to a team (used in 2 places currently, method was created for easier expansion). The areas that were targeted were users accepting an invitation to add someone to their team and the loop for adding users to mass created teams.
 


2. app/helpers/participants_helper.rb (Update to take into account duty) <br/>
17. [[File:Views studentTeams view changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/5dc3279ae056f70826244edfa143ebf3cc78fae1 app/views/student_teams/view.html.erb] <br/> Updated students team members table to identify the mentor.]]
[[File:Participants helper changes.png|thumb|center|520px|]]


3. app/models/assignment.rb (Update to take into account duty) <br/>
18. [[File:Views studentTask view changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/5237c238aaf314824f4de28ec5861830142afbd9 app/views/student_task/view.html.erb] <br/> Updated the student task view so that a mentor has new All Teams link so that the mentor can view all the teams they are mentoring.]]
[[File:Models assignment changes.png|thumb|center|520px|]]


4. app/models/participant.rb (Update to take into account duty) <br/>
19. [[File:Controllers studentTeamsController changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/b4002d8cfad2a4d1dbbb2ef9e96e5bdbbb5b68da app/controllers/student_teams_controller.rb] <br/> Updated so that the new mentor view can be accessed.]]
[[File:Models participant changes.png|thumb|center|520px|]]


5. app/views/participants/_participant.html.erb (Drop down UI)(Updated the table to diplay current duty so a mentor is easily identifiable in the table) <br/>
20. [[File:Config routes changes.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/8dce35d2e95260796c0d9e060da7ed6388062165 config/routes.rb] <br/> Updated the route for student_teams for the new mentor view.]]
[[File:Views particpants participant changes.png|thumb|center|520px|]]
[[File:Cont views particpants participant changes.png|thumb|center|520px|]]
[[File:Cont views participants participant.png|thumb|center|520px|]]


6. app/views/shared_scripts/_user_list.html.erb (Shows participants duty header for the column) <br/>
21.  
[[File:Views sharedScripts userList.png|thumb|center|520px|]]
::a) [[File:Mentor view partOne.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/c47a7ec7c212c42be9b5a0ad639ee60030afe241 NEW FILE app/views/student_teams/mentor.html.erb] <br/> Added a new view for a mentor to view all their teams.]]


7. app/views/shared_scripts/_add_individual.html.erb (Updated the singular import of a user to be able to import them as mentor)<br/>
::b) [[File:Mentor view partTwo.png|thumb|center|520px|[https://github.com/KPichon02/expertiza/commit/c47a7ec7c212c42be9b5a0ad639ee60030afe241 NEW FILE app/views/student_teams/mentor.html.erb] <br/> Added a new view for a mentor to view all their teams.]]
[[File:Views sharedscripts addIndividual changes.png|thumb|center|520px|]]


8. app/controllers/import_file_controller.rb (Added new param for the duty/role) <br/>
Changes 17-21 are related to the views for students and mentors to view their teams. #17 is a change to the student viewing their team, making it so the mentor is easily determined from the list of team members. #18 is a small text change to indicate to mentors that when clicking what was previously the 'view team' button, it will now show all teams they are on (but themselves and other mentors are not listed; just the students are listed). Changes 19-21 are related to this new 'All Teams' link, a link to a new webpage that shows all teams a mentor is on. This needed the new html file, a new method added to the controller so that when it returns the default rails behavior of rendering a page with a matching file name to the method name (the new file made), and a route to handle to this request.
[[File:Screenshot 2023-10-30 002612.png|thumb|center|520px|]]


9. app/views/import_file/_participant.html.erb (Updated table to account for duty) <br/>
== Final Phase Changes ==
[[File:Views import file participant changes.png|thumb|center|520px|]]


10. app/views/participants/_links.html.erb (Updated expected fields to expect the new duty column) <br/>
The following files had their references to 'duty' changed to be the new boolean 'can_mentor'
[[File:Views participants links changes.png|thumb|center|520px|]]


11. app/models/assignment_participant.rb (Updated the amount of expected items since duty is added and how a AssignmentParticipant is created) <br/>
1. app/controller/particpants_controller.rb<br>
[[File:Models assignmentParticipant changes.png|thumb|center|520px|]]
2. app/helpers/participants_helper.rb<br>
3. app/models/assignment.rb<br>
4. app/models/participant.rb<br>
5. app/controllers/import_file_controller.rb<br>
6. app/models/assignment_participant.rb<br>
7. app/models/team.rb<br>
8. app/models/mentor_management.rb<br>


12. app/models/mentor_management.rb (Balancing Algo) <br/>
An example from mentor_management.rb
[[File:Models mentor changes.png|thumb|center|520px|]]


13. app/controllers/teams_users_controller.rb (Fixed auto team creation with auto_mentor) <br/>
[[File:CanMentor.PNG]]
[[File:Controllers teamUsersController.png|thumb|center|520px|]]


14. app/models/invitation.rb (Fixed auto team creation with auto_mentor) <br/>
The following files had any reference of 'add_member_mentor_check' reverted back to 'add_member', the method was also removed entirely (shown in image below)
[[File:Models invintation changes.png|thumb|center|520px|]]


15. app/models/team.rb (Fixed auto team creation with auto_mentor)  <br/>
1. app/controllers/teams_users_controller.rb<br>
[[File:Models team changes.png|thumb|center|520px|]]
2. app/models/invitation.rb<br>
3. app/models/team.rb<br>
4. app/models/teams_user.rb<br>


16. app/models/teams_user.rb (Fixed auto team creation with auto_mentor) <br/>
[[File:NoMentorCheck.PNG]]
[[File:Models teamUser changes.png|thumb|center|520px|]]


17. app/views/student_teams/view.html.erb (Updated students team members table to identify the mentor) <br/>
Alongside the above reversion, a new subclass of AssignmentTeam called MentoredTeam was created which has its 'add_member' method overridden with the previous implementation of 'add_member_mentor_check'
[[File:Views studentTeams view changes.png|thumb|center|520px|]]


18. app/views/student_task/view.html.erb (Updated the student task view so that a mentor has new All Teams link so that the mentor can view all the teams they are mentoring) <br/>
app/models/mentored_team.rb
[[File:Views studentTask view changes.png|thumb|center|520px|]]


19. app/controllers/student_teams_controller.rb (Updated so that the new mentor view can be accessed) <br/>
[[File:MentoredTeam.PNG]]
[[File:Controllers studentTeamsController changes.png|thumb|center|520px|]]


20. config/routes.rb (Updated the route for student_teams for the new mentor view) <br/>
To allow for this new subclass to be created and function correctly, some modifications had to be made to the Teams Controller. The session[:team_type] object was being used for multiple purposes which did now scale easily for subclasses of either CourseTeam or AssignmentTeam to be integrated easily. As a work around, the session[:create_type] was introduced to remove some responsibility from session[:team_type] and facilitate the creation process for subclass of the prespecified Assignment and Course Teams.
[[File:Config routes changes.png|thumb|center|520px|]]


21. NEW FILE app/views/student_teams/mentor.html.erb (Added a new view for a mentor to view all their teams) <br/>
[[File:TeamsControllerChanges2351.PNG]]
[[File:Mentor view partOne.png|thumb|center|520px|]]
[[File:Mentor view partTwo.png|thumb|center|520px|]]


== Testing ==
== Testing ==


To test this project, we tested the development mode of our forked Expertiza branch against different scenarios. Given a test skeleton by teaching staff, we were able to ensure that the site was able to assign mentors automatically to a team given that the assignment allows the functionality and the teams have more than 50% the team capacity. Our tests were also able to validate input like checking for cases where no mentors are assigned to an assignment and whether it returns the mentor with the lowest team count to allow balanced responsibilities.
''System Testing'' <br>
The steps below were followed to test the UI of the application: <br>
1. Login as instructor with credentials at top of wiki page <br>
2. Go to '''Manage Assignments''' <br>
3. Click '''Add Participants''' to a particular assignment and the list of participants for the assignment should be shown <br>
4. If the role of any partipants needs to be changed, use the dropdown to the very right of the student <br>
5. If participants outside of the current list needs to be added to the assignment, the user has the option of '''importing''' through a file or using the single import option via the search bar (both can be found at the top of the Assignment Participant List view). This can also be used as a way to change roles of a participant being added to an assignment. <br>
6. Once participants are in place, instructor can create teams by navigating back to the Manage Assignments page and clicking '''Create Teams'''. <br>
7. Instructor is now presented the option of Create Teams, Import Teams, etc. By clicking '''Create Teams''', they can create a team of n students and assuming n is greater than 50% of the max team size, a mentor will be designated for each team in a way that responsibilities are balanced across all mentors. <br>
A single team can also be created by first setting a team and individually adding members to the team. Mentor should added once members have reached 50% capacity. <br>
8. To ensure teams are assigned to participants, instructor can impersonate the mentor and student view by going to the Manage tab and navigating to '''Impersonate User'''. Entering the participant ID will take you to their view. Clicking on the particular assignment will take you to a page that lets you view links 'Your Team' (for students) and 'All Teams' (for mentors). These pages will let you view the teams the user is assigned to along with showing who the mentor is (from student view).<br><br>
''Unit Testing'' <br>
spec/models/mentor_management_spec.rb <br>
''Tested the model class MentorManagement.rb'' <br><br>
Using the test skeleton provided by teaching staff, we were able to test the mentor_management.rb class with 23 test scenarios. Various scenarios were tested including:
* Automatically assigning a mentor once half-capacity has been reached
* Retrieving mentors for an assignment
* Ordering mentors by number of teams they mentor
* Mentor is email notified when assigned a team
* Error checking
[[File:Test Example.png|thumb|center|650px|Test Example]] <br>
[[File:Testing_Results.png|thumb|center|650px|Testing Results]] <br>


== Future improvements ==
== Future improvements ==
Future improvements of this feature would be to move away from the current implementation of checking mentors which is reliant on a single string field attached to each participant and to base it upon an attached duty object. The duty object already exists, but was not the path taken by E2115. We finished and fixed their implementation, but changing this may be desirable.
The other way to improve this feature would be to allow it to be functional for assignments without topics. This may be a difficult extension depending on how participants, topics, and teams are linked, but that is yet to be determined.

Latest revision as of 18:37, 11 December 2023

This wiki page is for the description of changes made under E2351 OSS assignment for Fall 2023, CSC/ECE 517.

Team Members

  • Kyle Pichon
  • Helen Solomon
  • Erik Lopez-Godinez (Phase 1)
  • Basaveswara Mukesh Suryadevara (Final Phase)

Mentor

  • Dr. Ed Gehringer


Problem Statement

The previous team, Project E2115, implemented the mentor_management.rb file which completed tasks such as auto assigning a mentor if the assignment chose to have that capability when the team is >50% full and also emailing the chosen mentor. It also implemented the methods of the mentor_management.rb in other files so that when the team surpassed 50% through inviting team members that a mentor was automatically assigned. The previous team implemented a lot for the new mentor duty that was planned to be added but they did not make a way to assign mentors, not through the UI or import so the changes they made could not be properly implemented. That is why our team was tasked with creating those changes in the UI and import so that participants could be made into mentors. Once we were able to have their changes be made there were some other things that needed to be changed.

  • Their algorithm was not properly balancing the mentor in terms of the amount of teams they would mentor.
  • We also noticed that when mass creating teams automatically it would not auto-assign mentors.
  • We also added changes to the users team members table so that the mentor is identifiable since perhaps in the future their would be a specific review for the mentor which would not be the same for if reviewing another student.
  • We also added a new view for the mentor since the Your Team view would only show the first team and mentors would be on multiple so we would need to display all their teams.

Design Document (Final Phase)

For the second half of this project, a refactoring of the first half is needed. There are 4 key points that will be addressed during this refactoring to clean up the code related to the automatic mentor management system for assignments that have it enabled.

1) Discard changes related to import functionality. This will be handled by a different project and entangling mentor management into it would add unneeded complexity to that future project when standard import then swapping a user to be a mentor from the UI would suffice for now.

2) Make sure that for every scenario in which a team user is created and added to a team, that a single method call is used.

3) Change the duty field of participants to be a boolean flag more in line with the can_review, can_submit, etc. flags that are used for other permissions. This was initially avoided because it will require a database migration but after reviewing how this choice complicated the code, this solution has been deemed more appropriate. It will be called can_mentor and all current checks in the code for :duty == 'mentor' will be exchanged for :can_mentor to replicate functionality.

4) Create a subclass of AssignmentTeam called MentoredTeam that will have overridden methods that loop-in the MentorManagement workflows where appropriate.

Beyond this general improvements of the code such as redoing comments to be much more detailed and fixing some method names to better represent what they actually do.

User Credentials

For users intending to view the deployed Expertiza associated with this assignment, the credentials are below:

  • Instructor login: username -> instructor6, password -> password

Expertiza Background

Expertiza is an educational web application created and maintained by the joint efforts of the students and the faculty at NCSU. It’s an open source project developed on Ruby on Rails platform and it’s code is available on Github. It allows students to review each other’s work and improve their work upon this feedback.

Description of the current project

First Demo -- https://youtu.be/WqBjv5Sluxg
Second Demo (Final Phase) -- https://youtu.be/wsTzlgR3oWs
VCL Instance -- http://152.7.178.198:8080

E2351 is an Expertiza based OSS project that handles the relationship between mentors, teams, and assignments. The ability to assign mentors with topics is implemented but lacked the ability to manage mentors for assignments without topics. Some refactoring within the assignment logic from the remnants of Project E2115 allowed us to accomplish some of our objectives.

Objectives

  • Enable the UI to be able to assign mentors role/duty to participant
  • Configure the import process to read an additional role/duty column
  • Fix the balancing of mentors using the auto assign functionality from the previous team
  • Fix the bug stopping mentors to be assigned when using the Automatically Create Teams function
  • Alter the participants table the student sees so that the mentor is identifiable in their team members table
  • Adding a new view for the mentor to view all the teams they are currently mentoring for the assignment

Files modified in phase 1 and the UI Changes

Enable the UI to be able to assign mentors role/duty to participant

1. app/controller/particpants_controller.rb (Update to take into account duty)
2. app/helpers/participants_helper.rb (Update to take into account duty)
3. app/models/assignment.rb (Update to take into account duty)
4. app/models/participant.rb (Update to take into account duty)
5. app/views/participants/_participant.html.erb (Drop down UI)(Updated the table to diplay current duty so a mentor is easily identifiable in the table)
6. app/views/shared_scripts/_user_list.html.erb (Shows participants duty header for the column)
7. app/views/shared_scripts/_add_individual.html.erb (Updated the singular import of a user to be able to import them as mentor)

Configure the import process to read an additional role/duty column

8. app/controllers/import_file_controller.rb (Added new param for the duty/role)
9. app/models/assignment_participant.rb (Updated the amount of expected items since duty is added and how a AssignmentParticipant is created)
10. app/views/import_file/_participant.html.erb (Updated table to account for duty)
11. app/views/participants/_links.html.erb (Updated expected fields to expect the new duty column)

Fix the balancing of mentors using the auto assign functionality from the previous team

12. app/models/mentor_management.rb (Balancing Algo)

Fix the bug stopping mentors to be assigned when using the Automatically Create Teams function

13. app/controllers/teams_users_controller.rb (Fixed auto team creation with auto_mentor)
14. app/models/invitation.rb (Fixed auto team creation with auto_mentor)
15. app/models/team.rb (Fixed auto team creation with auto_mentor)
16. app/models/teams_user.rb (Fixed auto team creation with auto_mentor)

Alter the participants table the student sees so that the mentor is identifiable in their team members table

17. app/views/student_teams/view.html.erb (Updated students team members table to identify the mentor)

Adding a new view for the mentor to view all the teams they are currently mentoring for the assignment

18. app/controllers/student_teams_controller.rb (Updated so that the new mentor view can be accessed)
19. config/routes.rb (Updated the route for student_teams for the new mentor view)
20. app/views/student_task/view.html.erb (Updated the student task view so that a mentor has new All Teams link so that the mentor can view all the teams they are mentoring)
21. NEW app/views/student_teams/mentor.html.erb (Added a new view for a mentor to view all their teams)

Changes made

1.

app/controller/participants_controller.rb
Permission definitions are altered to include 'can_mentor' within Participant Controller to indicate duty of participant.

2.

app/helpers/participants_helper.rb
Permission setting is altered to include 'can_mentor' within Participant Controller to indicate duty.

3.

app/models/assignment.rb
Making sure to account for duty of participant when being added to an assignment.

4.

app/models/participant.rb
Adding an additional authorization that is acquired from permissions set for participant.

Changes 1-4 were done to update the creation of participants to account for the duty field that was added by the previous mentor management group to enable filtering for mentors. The filtering requires that when a participant has the duty field filled with a string matching "mentor" but this functionality was not present. These changes fix this oversight.


5. (Drop down UI)(Updated the table to diplay current duty so a mentor is easily identifiable in the table)

a)
(1) app/views/participants/_participant.html.erb
Add the drop-down option for mentor and define set of permissions for role.
b)
(2) app/views/participants/_participant.html.erb
Update to take into account duty
c)
(3) app/views/participants/_participant.html.erb
Adding duty column to participants.

6.

app/views/shared_scripts/_user_list.html.erb
Shows participants duty header for the column


7.

app/views/shared_scripts/_add_individual.html.erb
Updated the singular import of a user to be able to import them as mentor

Changes 5-7 were the general UI fixes needed to show the mentor in the participants list allow for a participant to be individually added by user id already as a mentor, and allow for any participants permissions be changed to mentor from the already present dropdown. Visuals highlighting these changes are visible in the above section.

8.

app/controllers/import_file_controller.rb
Added new param for the duty/role

9.

app/views/import_file/_participant.html.erb
Updated table to account for duty

10.

app/views/participants/_links.html.erb
Updated expected fields to expect the new duty column

11.

app/models/assignment_participant.rb
Updated the amount of expected items since duty is added and how a AssignmentParticipant is created

Changes 8-11 are focused around the mass import functionality and adapting it to work with auto mentor assignment. The preview view after importing file needed an additional column to show the duty field of the participants, and the importing of files without headers needed an additional expected parameter to be added to also account for duty.


12.

app/models/mentor_management.rb
Adjusting the balancing algorithm.

Change 12 is fixing the balancing algorithm so each mentor will have almost the same number of teams as all other mentors on the assignment. The previous implementation was giving a single mentor to every group. An incorrect query was being done, and fixing this was the only issue needed to be resolved for full functionality.

13.

app/controllers/teams_users_controller.rb
Fixed auto team creation with auto_mentor.

14.

app/models/invitation.rb
Fixed auto team creation with auto_mentor.

15.

app/models/team.rb
Fixed auto team creation with auto_mentor.

16.

app/models/teams_user.rb
Fixed auto team creation with auto_mentor.

Changes 13-16 are about propagating the auto_assign_mentor functionality to the areas highlighted by the previous group that they were supposed to target. #16 shows a method added teams_user that loops in the mentor management check immediately after adding a user to a team (used in 2 places currently, method was created for easier expansion). The areas that were targeted were users accepting an invitation to add someone to their team and the loop for adding users to mass created teams.


17.

app/views/student_teams/view.html.erb
Updated students team members table to identify the mentor.

18.

app/views/student_task/view.html.erb
Updated the student task view so that a mentor has new All Teams link so that the mentor can view all the teams they are mentoring.

19.

app/controllers/student_teams_controller.rb
Updated so that the new mentor view can be accessed.

20.

config/routes.rb
Updated the route for student_teams for the new mentor view.

21.

a)
NEW FILE app/views/student_teams/mentor.html.erb
Added a new view for a mentor to view all their teams.
b)
NEW FILE app/views/student_teams/mentor.html.erb
Added a new view for a mentor to view all their teams.

Changes 17-21 are related to the views for students and mentors to view their teams. #17 is a change to the student viewing their team, making it so the mentor is easily determined from the list of team members. #18 is a small text change to indicate to mentors that when clicking what was previously the 'view team' button, it will now show all teams they are on (but themselves and other mentors are not listed; just the students are listed). Changes 19-21 are related to this new 'All Teams' link, a link to a new webpage that shows all teams a mentor is on. This needed the new html file, a new method added to the controller so that when it returns the default rails behavior of rendering a page with a matching file name to the method name (the new file made), and a route to handle to this request.

Final Phase Changes

The following files had their references to 'duty' changed to be the new boolean 'can_mentor'

1. app/controller/particpants_controller.rb
2. app/helpers/participants_helper.rb
3. app/models/assignment.rb
4. app/models/participant.rb
5. app/controllers/import_file_controller.rb
6. app/models/assignment_participant.rb
7. app/models/team.rb
8. app/models/mentor_management.rb

An example from mentor_management.rb

The following files had any reference of 'add_member_mentor_check' reverted back to 'add_member', the method was also removed entirely (shown in image below)

1. app/controllers/teams_users_controller.rb
2. app/models/invitation.rb
3. app/models/team.rb
4. app/models/teams_user.rb

Alongside the above reversion, a new subclass of AssignmentTeam called MentoredTeam was created which has its 'add_member' method overridden with the previous implementation of 'add_member_mentor_check'

app/models/mentored_team.rb

To allow for this new subclass to be created and function correctly, some modifications had to be made to the Teams Controller. The session[:team_type] object was being used for multiple purposes which did now scale easily for subclasses of either CourseTeam or AssignmentTeam to be integrated easily. As a work around, the session[:create_type] was introduced to remove some responsibility from session[:team_type] and facilitate the creation process for subclass of the prespecified Assignment and Course Teams.

Testing

To test this project, we tested the development mode of our forked Expertiza branch against different scenarios. Given a test skeleton by teaching staff, we were able to ensure that the site was able to assign mentors automatically to a team given that the assignment allows the functionality and the teams have more than 50% the team capacity. Our tests were also able to validate input like checking for cases where no mentors are assigned to an assignment and whether it returns the mentor with the lowest team count to allow balanced responsibilities.

System Testing
The steps below were followed to test the UI of the application:
1. Login as instructor with credentials at top of wiki page
2. Go to Manage Assignments
3. Click Add Participants to a particular assignment and the list of participants for the assignment should be shown
4. If the role of any partipants needs to be changed, use the dropdown to the very right of the student
5. If participants outside of the current list needs to be added to the assignment, the user has the option of importing through a file or using the single import option via the search bar (both can be found at the top of the Assignment Participant List view). This can also be used as a way to change roles of a participant being added to an assignment.
6. Once participants are in place, instructor can create teams by navigating back to the Manage Assignments page and clicking Create Teams.
7. Instructor is now presented the option of Create Teams, Import Teams, etc. By clicking Create Teams, they can create a team of n students and assuming n is greater than 50% of the max team size, a mentor will be designated for each team in a way that responsibilities are balanced across all mentors.
A single team can also be created by first setting a team and individually adding members to the team. Mentor should added once members have reached 50% capacity.
8. To ensure teams are assigned to participants, instructor can impersonate the mentor and student view by going to the Manage tab and navigating to Impersonate User. Entering the participant ID will take you to their view. Clicking on the particular assignment will take you to a page that lets you view links 'Your Team' (for students) and 'All Teams' (for mentors). These pages will let you view the teams the user is assigned to along with showing who the mentor is (from student view).

Unit Testing
spec/models/mentor_management_spec.rb
Tested the model class MentorManagement.rb

Using the test skeleton provided by teaching staff, we were able to test the mentor_management.rb class with 23 test scenarios. Various scenarios were tested including:

  • Automatically assigning a mentor once half-capacity has been reached
  • Retrieving mentors for an assignment
  • Ordering mentors by number of teams they mentor
  • Mentor is email notified when assigned a team
  • Error checking
Test Example


Testing Results


Future improvements

Future improvements of this feature would be to move away from the current implementation of checking mentors which is reliant on a single string field attached to each participant and to base it upon an attached duty object. The duty object already exists, but was not the path taken by E2115. We finished and fixed their implementation, but changing this may be desirable.

The other way to improve this feature would be to allow it to be functional for assignments without topics. This may be a difficult extension depending on how participants, topics, and teams are linked, but that is yet to be determined.