E1844 Issues related to names: Difference between revisions
(→RSpec) |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 41: | Line 41: | ||
Teams are generated within Expertiza in various scenarios. Teams are generated for every assignment, course and team names are generated in various formats at several places in the bidding code. Also, automatic generation of teams for assignment follows a different team name format. A single team name format was fixed, i.e. 'Team_random_no' (e.g. Team_51) and all the automatically generated teams were assigned a team name with the standardized format. | Teams are generated within Expertiza in various scenarios. Teams are generated for every assignment, course and team names are generated in various formats at several places in the bidding code. Also, automatic generation of teams for assignment follows a different team name format. A single team name format was fixed, i.e. 'Team_random_no' (e.g. Team_51) and all the automatically generated teams were assigned a team name with the standardized format. | ||
Standardizing team names is a good way to avoid discrepancy in team names irrespective of the source of team generation. This approach has been chosen because changing the parameter value (string of the team name) is the simplest way to standardize names of the auto-generated team names. We preserved the existing functionality of the functions and removed the use of unnecessary variables keeping the code DRY. | |||
Pseudocode standardizing auto-generated team names throughout expertiza | Pseudocode standardizing auto-generated team names throughout expertiza | ||
Line 50: | Line 52: | ||
==='''Issue #982 '''=== | ==='''Issue #982 '''=== | ||
Expertiza allows spaces in username. But, if a user has username with spaces then that user cannot be impersonated by an instructor. Thus, the task is to prohibit users from having spaces in usernames. | Expertiza allows spaces in username. But, if a user has username with spaces then that user cannot be impersonated by an instructor. Thus, the task is to prohibit users from having spaces in usernames. | ||
By doing so, it increases the user-friendly quotient of Expertiza. Even if the username is created by using spaces, the white spaces are removed from the string by the following pseudocode. Thus, the username can now be impersonated in the same way as any username having no white spaces at all. | |||
Pseudocode representing the logic we have used to modify app_models_user.rb | Pseudocode representing the logic we have used to modify app_models_user.rb | ||
Line 56: | Line 60: | ||
disallow spaces using regex /\s/ | disallow spaces using regex /\s/ | ||
=='''Login Credentials'''== | |||
1.) Login as instructor, | |||
Username: instructor6 | |||
Password: password | |||
2.) Login as student, | |||
Username: student7348 | |||
Password: password | |||
Username:student7349 | |||
Password: password | |||
=='''Development'''== | =='''Development'''== | ||
Line 90: | Line 106: | ||
1)Login as Instructor, create an OSS assignment for bidding with all the necessary details like maximum no of users per team, add topics for the assignment, add participants(students) in the assignment. | 1)Login as Instructor, create an OSS assignment for bidding with all the necessary details like maximum no of users per team, add topics for the assignment, add participants(students) in the assignment. | ||
2)Login as a Student(say | 2)Login as a Student(say Student7348), whom you have enrolled in the assignment. You should be able to see the assignment now in the Assignment section. | ||
3)Click on the assignment and then click on 'Your team'. | 3)Click on the assignment and then click on 'Your team'. | ||
4)Invite a student(say | 4)Invite a student(say Student7349) whom you have also added as a participant in your assignment, to be your teammate. | ||
5)Login as | 5)Login as student7349 and accept student7348's request to join his/her team. | ||
6)Now, the team name would appear on the top section of the webpage. The team name would be of format : Team_RandomNumber ( say Team_21 ). | 6)Now, the team name would appear on the top section of the webpage. The team name would be of format : Team_RandomNumber ( say Team_21 ). |
Latest revision as of 15:01, 10 November 2018
Introduction
Problem Statement
In Expertiza, teams are created for every homework. Somewhere in the bidding code, or the code that assigns topics based on bids, team names are generated. In this case, team names are not appended to the name of the assignment, like they are when teams are created elsewhere in the code. The team names should be of the form "Team_random_number". Also currently, the usernames can have spaces in them but then you cannot impersonate that user. The expertiza should prohibit spaces in usernames.
Issues to be fixed
Issues as described by the problem statement:
Issue #842
Team names created by bidding are incorrect Somewhere in the bidding code, or the code that assigns topics based on bids, team names are generated. In this case, team names are not appended to the name of the assignment, like they are when teams are created elsewhere in the code. Team names generated everywhere must be standardized.
Issue #982
Usernames can have spaces in them. And currently, if you create a user with a space in the username, you can't impersonate that user. Expertiza should prohibit spaces in usernames. Implementation should probably just include a format check in the user model, and tests to validate a username.
Modified Files
Issue #842
1) app/controllers/lottery_controller.rb
2) app/controllers/suggestion_controller.rb
3) app/models/team.rb
4) spec/models/team_spec.rb
Issue #982
1) app/models/user.rb
2) spec/models/user_spec.rb
Approach used to resolve the issues
Issue #842
Teams are generated within Expertiza in various scenarios. Teams are generated for every assignment, course and team names are generated in various formats at several places in the bidding code. Also, automatic generation of teams for assignment follows a different team name format. A single team name format was fixed, i.e. 'Team_random_no' (e.g. Team_51) and all the automatically generated teams were assigned a team name with the standardized format.
Standardizing team names is a good way to avoid discrepancy in team names irrespective of the source of team generation. This approach has been chosen because changing the parameter value (string of the team name) is the simplest way to standardize names of the auto-generated team names. We preserved the existing functionality of the functions and removed the use of unnecessary variables keeping the code DRY.
Pseudocode standardizing auto-generated team names throughout expertiza
Identify all the create methods for teams that are generated automatically Modify the team name passed to the team create or generate methods to the standardized format
Issue #982
Expertiza allows spaces in username. But, if a user has username with spaces then that user cannot be impersonated by an instructor. Thus, the task is to prohibit users from having spaces in usernames.
By doing so, it increases the user-friendly quotient of Expertiza. Even if the username is created by using spaces, the white spaces are removed from the string by the following pseudocode. Thus, the username can now be impersonated in the same way as any username having no white spaces at all.
Pseudocode representing the logic we have used to modify app_models_user.rb
If username has spaces disallow spaces using regex /\s/
Login Credentials
1.) Login as instructor,
Username: instructor6 Password: password
2.) Login as student,
Username: student7348 Password: password
Username:student7349 Password: password
Development
Issue #842
Following are the identified team creation methods and corresponding code changes:
app/controllers/lottery_controller.rb
app/controllers/suggestion_controller.rb
app/models/team.rb
Issue #982
The validation check has been added to the model of the user class so that no white spaces are present in the username :
app/models/user.rb
Test Plan
Issue #842
Steps performed
1)Login as Instructor, create an OSS assignment for bidding with all the necessary details like maximum no of users per team, add topics for the assignment, add participants(students) in the assignment.
2)Login as a Student(say Student7348), whom you have enrolled in the assignment. You should be able to see the assignment now in the Assignment section.
3)Click on the assignment and then click on 'Your team'.
4)Invite a student(say Student7349) whom you have also added as a participant in your assignment, to be your teammate.
5)Login as student7349 and accept student7348's request to join his/her team.
6)Now, the team name would appear on the top section of the webpage. The team name would be of format : Team_RandomNumber ( say Team_21 ).
Screenshots from conducted Test
1. On clicking Manage and then on assignments, following page appears.
2. Click on copy assignment icon and edit the information as per requirement. A new assignment would be created.
3. Now login as student7609 and click on 'Test Assignment'(assignment that you have created as an instructor) under Assignment tab.
4. Click on 'your team' and send teammate invitation to another student7508.
5. Now login as Student7508 and accept the teammate request of student7609. You can view the team name 'Team_7' at the top of the page which is the required standardized format.
RSpec
Issue #842
The existing Rspec test is modified so that the expected value of the team name is modified to the new format.
spec/controllers/team_spec.rb
Issue #982
The existing Rspec file user_spec.rb is modified in order to add another test case to validate the use of white spaces in the username.