app/controllers/participants_controller.rb
def view_publishing_rights
    # Get the assignment ID from the params
    assignment_id = params[:id]

    # Get the assignment object for the above ID and set the @assignment_name object for the view
    assignment = Assignment.find(assignment_id)
    @assignment_name = assignment.name

    # Initially set to false, will be true if the assignment has any topics
    @has_topics = false

    # Attribute that contains the list of the teams and their info related to this assignment
    @teams_info = []

    # Get all the teams that work on the assignment with ID assignment_id
    teams = Team.find_by_sql(["select * from teams where parent_id = ?", assignment_id])

    # For each of the teams, do
    teams.each do |team|
      team_info = {}
      # Set the team name
      team_info[:name] = team.name
      # List that hold the details of the users in the team
      users = []
      # For each of the users, do
      team.users.each do |team_user|
        # Append the user info to the users list
        users.append(get_user_info(team_user, assignment))
      end
      # Append the users list to the team_info object
      team_info[:users] = users

      # Get the signup topics for the assignment
      @has_topics = get_signup_topics_for_assignment(assignment_id, team_info, team.id)

      # Choose only those teams that have signed up for topics
      team_without_topic = !SignedUpTeam.where(["team_id = ?", team.id]).any?
      next if @has_topics && team_without_topic

      # Append the hashmap to the list of hashmaps
      @teams_info.append(team_info)
    end
    @teams_info = @teams_info.sort_by {|hashmap| [hashmap[:topic_id] ? 0 : 1, hashmap[:topic_id] || 0] }
  end
# Seems like this function is similar to the above function> we are not quite sure what publishing rights mean. Seems like
# the values for the last column in http://expertiza.ncsu.edu/student_task/list are sourced from here
Seems like this function is similar to the above function> we are not quite sure what publishing rights mean.
Seems like this function is similar to the above function > we are not quite sure what publishing rights mean .
def view_publishing_rights
    assignment_id = params[:id]
    assignment = Assignment.find(assignment_id)
    @assignment_name = assignment.name
    @has_topics = false
    @teams_info = []
    teams = Team.find_by_sql(["select * from teams where parent_id = ?", assignment_id])
    teams.each do |team|
      team_info = {}
      team_info[:name] = team.name
      users = []
      team.users.each do |team_user|
        users.append(get_user_info(team_user, assignment))
      end
      team_info[:users] = users
      @has_topics = get_signup_topics_for_assignment(assignment_id, team_info, team.id)
      team_without_topic = !SignedUpTeam.where(["team_id = ?", team.id]).any?
      next if @has_topics && team_without_topic
      @teams_info.append(team_info)
    end
    @teams_info = @teams_info.sort_by {|hashmap| [hashmap[:topic_id] ? 0 : 1, hashmap[:topic_id] || 0] }
  end
def view_publishing_rights assignment_id = params [ :id ] assignment = Assignment . find ( assignment_id ) @assignment_name = assignment . name @has_topics = false @teams_info = [ ] teams = Team . find_by_sql ( [ "select * from teams where parent_id = ?" , assignment_id ] ) teams . each do | team | team_info = { } team_info [ :name ] = team . name users = [ ] team . users . each do | team_user | users . append ( get_user_info ( team_user , assignment ) ) end team_info [ :users ] = users @has_topics = get_signup_topics_for_assignment ( assignment_id , team_info , team . id ) team_without_topic = ! SignedUpTeam . where ( [ "team_id = ?" , team . id ] ) . any? next if @has_topics && team_without_topic @teams_info . append ( team_info ) end @teams_info = @teams_info . sort_by { | hashmap | [ hashmap [ :topic_id ] ? 0 : 1 , hashmap [ :topic_id ] || 0 ] } end
Seems like this function is similar to the above function> we are not quite sure what publishing rights mean.
Seems like this function is similar to the above function > we are not quite sure what publishing rights mean .
# Get the assignment ID from the params # Get the assignment object for the above ID and set the @assignment_name object for the view # Initially set to false, will be true if the assignment has any topics # Attribute that contains the list of the teams and their info related to this assignment # Get all the teams that work on the assignment with ID assignment_id # For each of the teams, do # Set the team name # List that hold the details of the users in the team # For each of the users, do # Append the user info to the users list # Append the users list to the team_info object # Get the signup topics for the assignment # Choose only those teams that have signed up for topics # Append the hashmap to the list of hashmaps