CSC/ECE 517 Fall 2017/E1779. Fix teammate advertisements and requests to join a team

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Problem Statement

In Expertiza, there are teammate advertisement, invitation and join team request features which facilitate students to form teams. Teammate advertisement works only for assignments with topics. The topic holders can create advertisement and a trumpet icon will show on the signup sheet page. If one respond to the advertisement, a join team request will be created and the topic holder can see it on “Your team” page. After a student gets a team and the team is not full, (s)he should also be able to send invitations to others.


Issues to be fixed

Issues as described by the problem statement:

Fix Issue #311: When one responds to an advertisement, (s)he should only be able to respond once. When a team advertises for new members, someone who responds to an ad should only be allowed to respond once. Currently, after someone responds to an ad, they can respond again an unlimited number of times.

Fix Issue #227 : If user 'A' got a topic and user 'B' got no topic, then if A join B’s team, A’s topic is dropped and A and B end up with a new team with no topic. This issue should be handle carefully because we cannot simply add B to A’s team (imagine, if A has teammate X and B has teammate Y...). One of a potential fix is that, for assignment w/ topics, one cannot not post an ad unless (s)he holds a topic, similarly, one cannot sent invitations unless (s)he holds a topic.


Modified Files

1) app/models/sign_up_sheet.rb

2) app/helpers/student_teams_helper.rb

3) app/views/sign_up_sheet/_table_line.html.erb

4) app/views/student_teams/view.html.erb


Approach taken to resolve the issues

Issue #311

A user who is enrolled in an assignment and has a topic, can advertise for more team members. When another user goes on the 'your team' link, who is enrolled in the same assignment but doesn't have a team and topic yet, he will be able to see the team advertisements by other teams. He can respond to any of the available advertisements. As soon as he responds to an advertisement, an entry is created in the "join_team_requests" table and the "status" attribute of the corresponding tuple holds "P" value signifying pending status. This request goes to the team who had posted that advertisement. The request can be approved or denied by the team members. In either of the case, the "status" changes to "A" or "D" respectively for that entry.

If there is an entry in the "join_team_requests" table for a user, then (s)he can only see advertisements if the corresponding "status" is "D", which implies that this user is not yet part of a team. This can be checked by querying for participant_id, which is unique for each combination of (user_id, assignment_id), and then checking the "status" corresponding to that participant_id.

Pseudocode representing the logic we have used to modify sign_up_sheet.rb:

 Respond_To_Ads(user_id, assignment_id)
 p_id=Fetch participant_id corresponding to (user_id, assignment_id)
 Check entries for p_id in table join_team_request_table where status is either "A" or "P"
 count=number of such entries
 return count

Pseudocode representing the logic we have used to modify view.html.erb:

 If Sign Up Sheet has topics for a particular assignment()
 If Respond_To_Ads(user_id, assignment_id) is equal to 0
    Show Trumpet icon which is a link to the Ads



Issue #227

If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise. The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams, team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates. If the assignment doesn't have a topic then the user will be able to send out team invitations.

Pseudocode representing the logic we have used to modify student_teams_helper.rb:

 StudentTeamsHelper	
   If the concerned assignment has topics
      return false if their are topics	
   else return true
 User_Has_Topic(user_id, assignment_id)
   Query the database using inner joins between SignUpTopic, signed_up_teams, team_users
   rows= number of rows returned by the above query
   If rows>0
      return true
   else
      return false

Pseudocode representing the logic we have used to modify view.html.erb:

 If concerned assignment does not have topics OR User_Has_Topic is true
      Make Invite link visible

Test Plan

Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.


https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d


https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d


Issue #311

1)Login as Admin, create an assignment with all the necessary details like maximum no of users per team, add topics for the assignment, enroll users(students) in the assignment.

2)Login as user(Student) or impersonate a student, say student A, whom you have enrolled in the assignment. You should be able to see the assignment now in the Assignment section.

3)Since A doesn't have a topic yet, so you won't be able to see the advertise link.

4)Go to the sign-up sheet for the assignment, select a topic. A now has a topic, so now A can advertise for team-members.

5)Post an advertisement-"Need team-members who know Ruby."

6)Login as another user(Student) or impersonate another student, say student B, whom you have enrolled in the assignment.

7)Since B doesn't have a topic yet, so you won't be able to see the advertise link.

8)Go to the sign-up sheet for the assignment, you'll be able to see a trumpet icon next to the topic that has an ad posted.

9)Click on the icon, you'll see the ad posted by A. Click on request to join A's team.

10)On doing so an entry is created on the table "" and status holds value "P" signifying a pending request.

11)Now if you go on the sign-up sheet again, you will no longer see the trumpet icon through which you can access the ads since you have already responded to an ad and the request is in pending state.

12)Login as user A or impersonate A, now you'll be able to see the team join request sent by user B.

13) Now, you can either approve it or decline it. Suppose you approve it, B will become a part of your team, and the status will change to "A". And now if you login as B or impersonate B, you will no longer be able to access the trumpet icon which is a link to all ads pertaining to topics the concerned assignment.

14)Had user A declined User Bs join request, the status in the table "" would change to "D", that means user B still doesn't have a team. So, now if you login as B or impersonate, you'll be able to see the ads again.


Issue #227

1)Login as user(Student) or impersonate a student, say student A, whom you have enrolled in the assignment.

2)You should be able to see the assignment now in the Assignment section. Since A doesn't have a topic yet, so you won't be able to see the advertise link.

3)Go to the sign-up sheet for the assignment, select a topic. A now has a topic, so now A can advertise for team-members. Post an advertisement-"Need team-members who know Ruby."

4)This ensures that for an assignment with topics, a user can send out advertisements only if (s)he has a topic.

5)Login as Admin, create an assignment with all the necessary details like maximum no of users per team, do not add topics for the assignment, enroll users(students) in the assignment.

6)Login as user(Student) or impersonate a student, say student A, whom you have enrolled in the assignment. You should be able to see the assignment now in the Assignment section.

7)Since the assignment doesn't have any topics, therefore, you will be able to see the advertise link. You won't see a sign-up sheet since the assignment has no topics. You can advertise for teammates.

Screenshots from conducted Test

1) On clicking on 'Manage Content' the following screen is rendered which lists the existing assignments.



2) On clicking on 'New Public Assignment' the following form is displayed in which assignment details can be entered.



3)Editing the created assignment.



4)Click on 'Topics' to add topics for the assignment.



5)Click on 'Rubrics' to set up assignment rubrics.



6)The following screenshot shows the completed setup.



7)On clicking on the image-link for adding participants for an assignment, the following screen is rendered.



8)Showing all added participants.



9)The following screen is rendered when a student who is a participant in the current assignment clicks on it's sign-up sheet.



10)The following screen is rendered when a participant clicks on the sign-up sheet for the assignment. link.



11)The following screen is rendered when a participant chooses a topic and then clicks on 'create advertisement'.



12)After creating an ad, user can now see a horn icon which is a link to display the advertisements corresponding to that topic in that assignment.



13)The following screen is rendered after clicking on the horn icon.



14)The following screen is rendered after clicking on the link 'Request invitation'.



15)After sending a request to join a team (via ad), the user will no longer see the link for the ads unless the request is denied by the receiver.



16)This is the screen of the user who had created the ad. He is now able to see any join requests that he can approve/decline.