User:Jitesh

From Expertiza_Wiki
Revision as of 00:53, 24 March 2016 by Jitesh (talk | contribs)
Jump to navigation Jump to search

CSC/ECE 517 Spring 2016 - Expertiza E1613

This wiki page is for the description of changes made according to the specification of E1613 OSS assignment for Spring 2016.

Peer Review Information

For testing the changes made, the following credentials are recommended:

  • Instructor Login: username: instructor6 password: password
  • Student Login: username: student11 password: password
  • Student Login: username: student1862 password: password

The above users are suggested for testing because there are a few users which would lead to exceptions upon login for unknown reasons completely unrelated to our work.

Introduction

Background

Expertiza is a web portal which can be used to manage assignments related to a course. It provides a platform to view assignments, manage teams, select topics and work improvement through anonymous peer reviews. For the instructor it provides complete control to create assignments, view reviews submitted and provide feedback. The instructors also have an option to publish the students work based on the rights provided by the student.

Problem Statement

The following were the tasks identified to accomplish through this project. These tasks are part of the sign_up_sheet_controller.rb and sign_up_topic.rb

  • WI-1: Method ad_info in the sign_up_sheet_controller.rb users sql query to retrieve the desired objects. This needs to be changed so that action records are used instead and a hash/array of the required object is returned.
  • WI-2: Delete the method add_default_microtask after confirming that there is no reference to the method.
  • WI-3: The view_publishing_rights method brings up a webpage to the instructor on whether the course staff has been granted or denied the right to use each submission in the future. The current implementation of the project works only for assignments that have topics assigned to them. This needs to be enhanced to include assignments that do not have associated topics as well. Another change that needs to be brought about is that the view_publishing_rights needs to be refactored and moved to the participants controller.
  • WI-4: The methods slotAvailable? implemented in the sign_up_sheet_controller.rb needs to be removed from the controller. The methods should only exist in the corresponding model.
  • WI-5: Method other_confirmed_topic_for_user is only referenced by the method waitlist_teams. The method wait_list_teams is not referenced anywhere. These methods need to be removed if it is confirmed that they are not used anywhere else.
  • WI-6: Expertiza provides a functionality to import topics from a file(.csv or .txt). This feature is currently not tested. Test the functionality of this feature and fix it if broken. Another change that needs to be brought about is that the current implementation requires that each row of the imported file needs to have four columns. However the fourth column which represents "category" is not mandatory and it should be possible to import a document which does not include values for this column.
  • WI-7: Add Rspec testcases to test the changes implemented above.

Files Modified in this Project

The following files were modified for this project.

  • app/controllers/participants_controller.rb
  • app/controllers/sign_up_sheet_controller.rb
  • app/models/sign_up_topic.rb
  • app/models/signed_up_team.rb
  • app/models/team.rb
  • app/models/waitlist.rb
  • app/views/participants/view_publishing_rights.html.erb
  • app/views/sign_up_sheet/list.html.erb
  • app/views/sign_up_sheet/show_team.html.erb
  • app/views/sign_up_sheet/view_publishing_rights.html.erb
  • app/views/tree_display/actions/_assignments_actions.html.erb
  • app/helpers/import_topics_helper.rb
  • app/assets/javascripts/tree_display.jsx
  • config/routes.rb
  • spec/features/instructor_interface_spec.rb
  • spec/features/team_creation_spec.rb

Solutions implemented and Delivered

  • WI-1:

For this work item the following files were modified:

app/controllers/sign_up_sheet_controller.rb: In this file the method ad_info is defined. This method was defined using sql query to provide its results. To change this method in such a way that it uses active record associations changes needed to be made to the function as shown below. Additionally since the new implementation returns a list of hashes the way in which this result is accessed in show_team method was also changed to accommodate this change.

Previous Code:

 def ad_info(assignment_id, topic_id)
   query = "select t.id as team_id,t.comments_for_advertisement,t.name,su.assignment_id, t.advertise_for_partner from teams t, signed_up_teams s,sign_up_topics su "+
       "where s.topic_id='"+topic_id.to_s+"' and s.team_id=t.id and s.topic_id = su.id;    "
   SignUpTopic.find_by_sql(query)
 end

Modified Code:

 def ad_info(assignment_id, topic_id)
   # List that contains individual result object
   @result_list = []
   # Get the results
   @results = SignedUpTeam.where("topic_id = ?", "#{topic_id}")
   # Iterate through the results of the query and get the required attributes
   @results.each do |result| 
     team = result.team
     topic = result.topic
     resultMap = {}
     resultMap[:team_id] = team.id
     resultMap[:comments_for_advertisement] = team.comments_for_advertisement
     resultMap[:name] = team.name
     resultMap[:assignment_id] = topic.assignment_id
     resultMap[:advertise_for_partner] = team.advertise_for_partner
     # Append to the list
     @result_list.append(resultMap)
   end
   @result_list
 end

Additionally changes were also required in the models signed_up_team.rb and team.rb. This was because these associations were required to fetch required data using active record associations. The following changes were made to the files:

app/models/signed_up_team.rb:

 class SignedUpTeam < ActiveRecord::Base
   belongs_to :topic, :class_name => 'SignUpTopic'
   belongs_to :team, :class_name => 'Team' #Added this association between SignedUpTeam and Team.

app/models/team.rb

 class Team < ActiveRecord::Base
   has_many :teams_users, :dependent => :destroy
   has_many :users, :through => :teams_users
   has_many :join_team_requests
   has_one :team_node,:foreign_key => :node_object_id,:dependent => :destroy
   has_many :bids, :dependent => :destroy
   has_many :signed_up_teams #Added this association between Team and SignedUpTeam.