CSC/ECE 517 Spring 2022 - E2244. Support for saying your team pair-programmed
Introduction
E2244 introduces a new feature of pair-programming for the teams. Pair-programming feature will allow the instructor to create an assignment with the option for pair-programming. It will allow the team members to work in collaboration and commit using a single account.
Problem Statement
Expertiza allows the students to form teams for a given assignment. At times the students wish to submit or commit their work in a collaborative way from a single account. As of now, expertiza does not capture this intent of the students which makes it difficult for the instructors and the teaching assistants to understand whether all the students have contributed towards the assignment and students have to commit using different accounts to show their work. E2244 will allow the instructors to create a new assignment with the pair-programming feature which will allow the students to mark whether they performed pair-programming or not for a given assignment. It will also ensure that all the team members have agreed to pair-programming. The instructors and teaching assistants will be able to view whether a team has opted for pair-programming or not on the UI.
What needs to be done
- Student view
- A button for requesting pair-programming
- Pair-programming initiators - the user's view who has requested for pair-programming
- Pair-programming receivers - all the other users to who have to accept/decline the pair-programming request
- Instructor/Teaching Assistant view
- has pair-programming? checkbox on the create assignment page
- pair programming column of a given assignment which will show if a team has opted for pair-programming or not.
- Table changes
- Teams table - Add a new attribute for pair-programming (pair_programming_request)
- Teams Users table - Add a new attribute to capture individual acceptance or rejection of pair-programming request (pair_programming_status).
- Assignment table - Add a new attribute for pair-programming (enable_pair_programming)
Design
Files Requiring Modification
- app/views/assignments/edit/_general.html.erb
It appears this partial renders the general tab of the create new assignments page. We need to add a checkbox for pair programming in this file under has teams option.
- app/views/assignments/list_submissions.html.erb
This file renders the list of all the submissions for a given assignment. We need to add a new column - pair-programming which will indicate if the team has pair-programmed for this assignment or not.
- app/views/student_teams/view.html.erb
This file renders the team information of a given assignment for a particular member. We need to add a table for pair-programming and a button to request for pair-programming.
- app/models/assignment.rb
This is a model for an assignment. We will add a method pair_programming_enabled? in this file. This will allow us to check if pair-programming has been enabled in the current assignment.
- app/controllers/pair_programming_controller.rb
We have created a new controller to handle the send invitation and accept/decline feature.
Wireframes
- Instructor view
If the instructor while creating an assignment enables the has_teams checkbox they will be able to see the pair_programming option and can enable it.
The instructor can also view which team has opted for pair-programming.
- Student View
If an assignment has pair programming option enabled, the student will be able to see a button "Request for pair programming" and can click on it if they want to opt for pair programming for the assignment. A request will be sent to all the team members which they can accept or reject. The status of pair programming will remain "No" unless all the members of the team have accepted the request. If any of the team members declines the request the pair programming button re-appears.
Flow Diagrams
- Instructor enables pair programming for an assignment
- Instructor views teams that have performed pair-programming for a particular assignment
- Student initiates a request for pair-programmming
- Student accepts the pair-programming invitation
- Student declines the pair-programming invitation
Implementation
- Pair Programming Checkbox only when has_teams? is checked in create/edit assignment view
- Request to Pair Programming button in the student_teams view
- Once button is clicked, an invitation is sent to all the team members and the status of pair programming for the team is displayed in place of the button. Initial status is pending. A pair programming invitation section is also displayed along with the invitation status of each team member.
- Invitation receiver will have option to accept/decline the request
- Once all the team members have accepted the invitation, the status of pair programming is set to yes
- Instructor will view the status of pair programming of each team in the view submissions page
Test Plan
As this is a new feature, we will perform UI testing (functional) as well as unit testing. Following are the specifics of the testing that will be performed:
Functional Testing
- Scenario 1: Test pair-programming? checkbox visibility
Given: Instructor has logged in When: Instructor clicks on new assignment Then: pair-programming? checkbox is visible
- Scenario 2: Test pair-programming? checkbox ticked
Given: Instructor has logged in When: Instructor clicks on new assignment And: Instructor checks the pair_programming checkbox And: Instructor fills the other required details And: Instructor clicks on create assignment Then: pair-programming is enabled for the assignment
- Scenario 3: Test pair-programming column in the Instructor view assignment page
Given: Instructor navigates to a particular assignment with pair-programming enabled When: Instructor clicks on view submissions Then: Instructor is able to view the submissions along with the pair-programming column
- Scenario 4: Test request for pair-programming button sends invitations to the team members
Given: Student is logged in and is assigned to an assignment When: Student clicks on the Request for pair-programming button Then: All other team members should receive the invitation for pair-programming
- Scenario 5: Test sender status for pair-programming is accepted
Given: Student is on the teams page of an assignment When: Student clicks on the request for pair-programming button Then: The pair-programming status for the sender is marked as accepted
- Scenario 5: Test pair-programming invitation is visible to the student
Given: Another student has initiated pair-programming When: Student navigates to the view teams page Then: Student is able to see the accept|decline invitation
- Scenario 6: Test pair-programming invitation acceptance
Given: Student is able to see the accept|decline invitation When: Student clicks on the accept invitation link Then: Pair-programming status for the student is accepted
- Scenario 7: Test pair-programming invitation declined
Given: Student is able to see the accept|decline invitation When: Student clicks on the decline invitation link Then: Pair-programming status for the student is declined And: Request for pair-programming button is visible
- Scenario 8: Request for pair-programming button is hidden after student clicks on the button
Given: Student is able to see request for pair-programming button When: Student clicks on the request for pair-programming button Then: request for pair-programming button is hidden for all the team members
Unit Testing
- spec/pair_programming_controller_spec.rb
We have written tests to cover all the 4 methods of the pair_programming_controller.
The methods in the controller are:
- action_allowed?
- send_invitations
- accept
- decline
Test Frame for pair programming controller
1. action_allowed? - When the user tries to access the pair programming feature this method is called to check if the current user is authorized to perform the action. All the users having student privileges can access the pair programming functionality.
Code Snippet:
describe '#action_allowed?' do #check if super-admin is able to perform the actions it 'allows super_admin to perform certain action' do stub_current_user(super_admin, super_admin.role.name, super_admin.role) expect(controller.send(:action_allowed?)).to be_truthy end #check if instructor is able to perform the actions it 'allows instructor to perform certain action' do stub_current_user(instructor1, instructor1.role.name, instructor1.role) expect(controller.send(:action_allowed?)).to be_truthy end #check if student is able to perform the actions it 'allows student to perform certain action' do stub_current_user(student1, student1.role.name, student1.role) expect(controller.send(:action_allowed?)).to be_truthy end #check if teaching assisstant is able to perform the actions it 'allows teaching assisstant to perform certain action' do stub_current_user(ta, ta.role.name, ta.role) expect(controller.send(:action_allowed?)).to be_truthy end #check if admin is able to perform the actions it 'allows admin to perform certain action' do stub_current_user(admin, admin.role.name, admin.role) expect(controller.send(:action_allowed?)).to be_truthy end end
2. send_invitations - When one of the team members requests for pair programming this method is called. This method is used to send pair programming invitations to all the team members.
Code Snippet:
describe '#send_invitations' do it 'sends pair programming invitation to all the team members' do users = allow(TeamsUser).to receive(:where).and_return([team_user1,team_user2]) [users].each do |user| allow(user).to receive(:update_attributes).and_return(true) end user1 = allow(TeamsUser).to receive(:find_by).and_return(team_user1) allow(user1).to receive(:update_attributes).and_return(true) team1 = allow(Team).to receive(:find).and_return(team) allow(team1).to receive(:update_attributes).and_return(true) user_session = { user: student1 } params = {team_id: team.id, user_id: student1.id} result = post :send_invitations, params: params, session: user_session expect(flash[:success]).to eq('Invitations have been sent successfully!') expect(result.status).to eq 302 expect(result).to redirect_to('/student_teams/view') end end
3. accept - When a team member accepts the pair programming invitation request this method is called. It updates the pair programming status to "accepted" for the team member and redirects to the team view page.
Code Snippet:
describe '#accept' do it 'accepts the pair programming request' do user1 = allow(TeamsUser).to receive(:find_by).and_return(team_user1) allow(user1).to receive(:update_attributes).and_return(true) user_session = { user: student1 } params = {team_id: team.id, user_id: student1.id} result = post :accept, params: params, session: user_session expect(flash[:success]).to eq('Pair Programming Request Accepted Successfully!') expect(result.status).to eq 302 expect(result).to redirect_to('/student_teams/view') end end
4. decline - When a team member declines the pair programming invitation request this method is called. It updates the pair programming status to "declined" for the team member and redirects to the team view page.
Code Snippet:
describe '#decline' do it 'declines the pair programming request' do user1 = allow(TeamsUser).to receive(:find_by).and_return(team_user1) allow(user1).to receive(:update_attributes).and_return(true) team1 = allow(Team).to receive(:find).and_return(team) allow(team1).to receive(:update_attributes).and_return(true) user_session = { user: student1 } params = {team_id: team.id, user_id: student1.id} result = post :decline, params: params, session: user_session expect(flash[:success]).to eq('Pair Programming Request Declined!') expect(result.status).to eq 302 expect(result).to redirect_to('/student_teams/view') end end
- spec/models/assignment_spec.rb
We have written test to cover one method which we added to the assignment.rb
Test frame for assignment.rb
- pair_programming_enabled? - This method is used to check whether the pair programming option is enabled for the assignment or not.
Code Snippet:
describe '#pair_programming_enabled?' do let(:assignment1) { build(:assignment, id: 1, name: 'assignment 1', enable_pair_programming: false) } let(:assignment2) { build(:assignment, id: 2, name: 'assignment 2', enable_pair_programming: true) } context 'checks if pair_programming is enabled' do it 'returns false' do expect(assignment1.pair_programming_enabled?).to be_falsey end it 'returns true' do expect(assignment2.pair_programming_enabled?).to be_truthy end end end
Important Links
Team Information
Atharva Rajendra Patil
Atharva Milind Joshi
Kriti Khullar
Rucha Kolekar