CSC/ECE 517 Spring 2017 E1714
Motivation
Prior to our modifications, the Expertiza system offered no way for instructors to sign up or drop students from a topic. Instructors could impersonate a student, but this introduced unnecessary complexity to the process. By adding access to the signup functionality on the assignments page, instructors can now easily fix mistakes or free up topics as needed.
Modifications
sign_up_sheet/_topic_name.html.erb
The topic_name partial is the primary view for this feature. It renders the table cell where the topic, team, and students are listed. The following code was modified:
The instructor will see a different set of links depending on whether or not a team has already been assigned to a topic. If no team is present, only a single link that adds a student and their team will be visible. If a team is already present, then an additional link that drops that existing team will be visible. In this case, the signup link will add students to the waitlist instead.
signup_sheet_controller.rb
The signup_sheet_controller is where most of the new functionality is introduced.
def signup_as_instructor_action
user = User.find_by(name: params[:username])
unless user.nil? # validate invalid user
unless SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])
flash[:error] = "The student has already signed up for a topic!"
end
flash[:success] = "You have successfully signed up the student for the topic!"
else
flash[:error] = "That student does not exist!"
end
redirect_to controller: 'assignments', action: 'edit', id: params[:assignment_id]
end
def delete_signup_as_instructor
# find participant using assignment using team and topic ids
team = Team.find(params[:id])
assignment = Assignment.find(team.parent_id)
teamUsr = TeamsUser.find_by(team_id: team.id)
user = User.find(teamUsr.user_id)
participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: assignment.id)
drop_topic_deadline = assignment.due_dates.find_by_deadline_type_id(6)
if !participant.team.submitted_files.empty? or !participant.team.hyperlinks.empty?
flash[:error] = "The student has already submitted their work, so you are not allowed to remove them."
elsif !drop_topic_deadline.nil? and Time.now > drop_topic_deadline.due_at
flash[:error] = "You cannot drop a student after the drop topic deadline!"
else
delete_signup_for_topic(assignment.id, params[:topic_id], participant.user_id)
flash[:success] = "You have successfully dropped the student from the topic!"
end
redirect_to controller: 'assignments', action: 'edit', id: assignment.id
end
Testing
Test Description | Expected Result | Tested File | Method Tested |
---|---|---|---|
row 1, cell 1 | row 1, cell 2 | row 1, cell 3 | row 1, cell 4 |
row 2, cell 1 | row 2, cell 2 | row 2, cell 3 | row 2, cell 4 |