CSC/ECE 517 Fall 2015/oss E1554 AAR: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 34: Line 34:


== Before ==
== Before ==
    .
.
    .
.
    if next_wait_listed_team
  if next_wait_listed_team
        team_id = next_wait_listed_team.team_id
    team_id = next_wait_listed_team.team_id
        team = Team.find(team_id)
    team = Team.find(team_id)
        assignment_id = team.parent_id
    assignment_id = team.parent_id
        next_wait_listed_team.is_waitlisted = false
    next_wait_listed_team.is_waitlisted = false
        next_wait_listed_team.save
    next_wait_listed_team.save
        Waitlist.cancel_all_waitlists(team_id, assignment_id)
    Waitlist.cancel_all_waitlists(team_id, assignment_id)
      end
  end
    .
.
    .
.






== After ==
== After ==
<syntaxhighlight lang="c++">
 
   
   
  .
  .
Line 59: Line 59:
  .
  .
  .
  .
</syntaxhighlight>


== References ==
== References ==
   
   
<references />
<references />

Revision as of 23:56, 31 October 2015

E1554 Refactoring TeamsController.rb This is description of the CSC/ECE 517 Fall2015 OSS project(E1554),we refactored teams_controller.rb,students_team_controller.rb,sign_up_topic.rb we extracted the duplicate code into a single function call,and we made sure when team is deleted its associated records are deleted first then the team gets deleted.We have tested using Rspec


Expertiza

Expertiza <ref>Expertiza.expertiza project</ref> is a project built with Ruby on Rails<ref>RubyonRails</ref>.It is mainly used by an instructor to provide a peer reviewing systems among the students it also supports team projects submissions wikis etc.

What it Does

This class handle the basic creation and modification of student teams. There are also some complicated actions. E.g., if a team get destroyed (this may be caused by instructor force this team to be destroyed, the students all leave the team), the topic held by this team should be transferred to next team which is on the waiting list, if there is any. These are the scenarios where topic transferring may happen:

  • when instructor destroys a team
  • when the last person leave this team
  • when this team wants to switch topic
  • when instructor wants to increase the available slots for a topic.


Problem Statement

The same code for handling topic transferring used 3 times at the following places:

[scenario 1] teams_controller line 95 (if next_wait_listed_team), 
[scenario 2] student_teams_controller line 139 (if first_waitlisted_team) and 
[scenario 4] sign_up_topic line 117 (if next_wait_listed_team). 
Scenario 3’s code is not copied, and one can find the code at line 92 in sign_up_topic.rb.


What Needs to be Done

  • Make topic_transfering a function call, and make sure all those 4 scenario works.
  • Write tests for all those 4 scenarios.
  • Record a video for those 4 scenarios, submit it to YouTube and submit the YouTube link to Expertiza.
  • Delete method in teams_controller.rb is complicated, “@team.destroy” should be called latest after all the records related to this team can be deleted.
  • write tests for delete method.


Before

.
.
 if next_wait_listed_team
   team_id = next_wait_listed_team.team_id
   team = Team.find(team_id)
   assignment_id = team.parent_id
   next_wait_listed_team.is_waitlisted = false
   next_wait_listed_team.save
   Waitlist.cancel_all_waitlists(team_id, assignment_id)
 end
.
.


After

.
.
if next_wait_listed_team
SignUpTopic.assign_to_first_waiting_team(next_wait_listed_team)
end
.
.

References

<references />