CSC/ECE 517 Fall 2017/E1793. Help students find teams to join

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

Problem Statement

For team-based assignments, it always takes time to find suitable team members. We already have bidding, which could help you to join in a team with other team members hold similar bidding preferences. However, you may not be satisfied with automated team formation and want to switch to another team. In this project, we will build a new feature to help students find teams to join.

Currently, there are 2 ways to find other students to join your team:

1.If your team is not full, you could invite people by inputting his/her UnityID. It will send an invitation to certain user. If s/he accept your invitation,s/he will leave original team and join your team. 2.You could create an advisement by clicking “Your team” link and then clicking “Create” link under “Advertisement for teammates” section. Then your advertisement will appear the last column of the signup sheet page with a horn icon. In this way, all classmates could see your advisement. Someone could send a request to join your team. If you accept their request, s/he will leave original team and join in your team.

It would be better for students who do not have team yet or whose team is not full yet to be able to see a list of students who don’t already have teams. So too for instructors.

Task Description

Fix the second way to find other students to join your team.

Currently, after you create an advertisement, the horn icon does not appear in the the last column of the signup sheet.

For student end:

Display a list of students who do not have a team with invitation links in student_teams#view page You could invite students to your team by clicking invitation links. If s/he accept your invitation,s/he will leave original team and join in your team. It will be more straightforward than typing UnityID.

For instructor end:

Display a list of students who do not have team in teams#list page

Write feature tests to verify your modifications:

Create team_invitation_spec.rb file in spec/features folder

Modified Files

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

2)app/views/join_team_requests/_list_received.erb

3)app/controllers/join_team_requests_controller.rb

4)app/models/join_team_request.rb

5)app/models/sign_up_sheet.rb

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

7)app/views/sign_up_sheet/_all_actions.html.erb

8)app/views/teams/list.html.erb

Approach taken to resolve the issues

issue1 When someone creates an ad ,the horny icon does not appear in the the last column of the signup sheet.the code that show horny icon is below:

<% if SignUpSheet.has_teammate_ads?(topic.id) %>
<%= link_to image_tag('ad.png', :border => 0, :title => 'Ad', :align => 'middle', :style => 'width: 24px; height:24px'), :controller=>'sign_up_sheet', 
:action=> 'show_team',assignment_id=>@assignment.id, :id=>topic.id%>
<% end %>

After debugging ,I found even if you create an ad before ,the if block of code will not be executed. Therefore something must be wrong with has_teammate_ads? method.Then I rewrite that method.Signupteam has an attribute:advertise_for_partner ,it will be set true after team members create an ad for their team.i return this attribute to the has_teammate_ads? method and the horny icon appears.This method code is below:

  def self.has_teammate_ads?(topic_id)
    @ads_exsit=false
    @result=SignedUpTeam.where("topic_id = ?", topic_id.to_s)
    @result.each do |result|
     team=result.team
     @ads_exsit=team.advertise_for_partner
     end
     @ads_exsit
   end