CSC/ECE 517 Spring 2017 E1714: Difference between revisions
m (→Solution) |
|||
Line 10: | Line 10: | ||
== Expected Functionality == | == Expected Functionality == | ||
=== Instructor | === Instructor Signs Up a Student For a Topic === | ||
From the instructor's edit assignments page with the tab topics selected, the instructor should see a list of topics for the given assignment. | From the instructor's edit assignments page with the tab topics selected, the instructor should see a list of topics for the given assignment. | ||
For each topic, the instructor should be able to: | For each topic, the instructor should be able to: | ||
* Sign a student up if "No choosers" is displayed | * Sign a student up if "No choosers" is displayed | ||
** If the student is part of a team, the whole team should be signed up | ** If the student is part of a team, the whole team should be signed up | ||
** If the student is not part of a team, a team should be created with only the given student as a member | ** If the student is not part of a team, a team should be created with only the given student as a member |
Revision as of 00:54, 1 April 2017
Motivation
Problem
In order to sign up or drop teams from a topic, an instructor must first impersonate a student and then perform the necessary action. The current workflow introduces unnecessary complexity to the process. To add or drop multiple teams, the instructor must impersonate each student and navigate back and forth between the same set of pages.
Solution
An instructor can view a list of all the topics for any given assignment. Each topic shows any signed up teams and whether students are signed up or waitlisted. The proposed change introduces a new button next to each team that allows an instructor to remove a team from a topic. In this manner, an instructor can drop a team from a topic with relative ease. Next, an additional button was implemented to give an instructor the option to signup a specific team for a topic. An instructor can select a team by specifying one of the team members. If the student specified by the instructor is not part of a team, a team is created for the student as part of the signup process. The signup button is located in the topic name box and redirects to a new page. The new page contains a form where the instructor can enter a student's name. Once a team is added, the instructor is redirected back to the edit assignment page where the topic is updated with the specified student's team.
Expected Functionality
Instructor Signs Up a Student For a Topic
From the instructor's edit assignments page with the tab topics selected, the instructor should see a list of topics for the given assignment. For each topic, the instructor should be able to:
- Sign a student up if "No choosers" is displayed
- If the student is part of a team, the whole team should be signed up
- If the student is not part of a team, a team should be created with only the given student as a member
- Sign a student up for the waitlist if a team is already signed up
- If the student is part of a team, the whole team should be signed up
- If the student is not part of a team, a team should be created with only the given student as a member
- The team should be added to the end of the waitlist
Each action is performed by choosing the green checkmark next to the desired topic name
Instructor removes a student's signup for a topic
From the instructor's edit assignments page with the tab topics selected, the instructor should see a list of topics for the given assignment. For each topic, the instructor should be able to:
- Remove a team's signup for a specific topic
- The team should no longer be signed up for the topic
- Any waitlisted teams should now be signed up for the topic
- Remove a team from the waitlist for a specific topic
- The team should be removed from the waitlist
Each action is done by choosing the x enclosed by a red circle next to the desired team
Peer Review Information
Please review the information below for further information on how to review the modifications made.
Login Information:
Username | Password | Role |
---|---|---|
instructor6 | password | instructor |
student4340 | password | student |
student4405 | password | student |
student6376 | password | student |
Review Steps:
- Check with assignments a student is signed up for
- Log in as a student
- On the main page, there should be a list of assignments which the user can be removed from signup
- Note removing the signup only works if the student hasn't turned in work or the drop deadline has not passed
- Add a student to a course or assignment
- Log in as an instructor
- Go to "Courses" tab to add a student to a course, go to "Assignments" tab to add a student to an assignment
- Choose "Add Participants" button under "Actions" column. It appears as a person wearing a blue shirt with a gree plus above them
- The list shows all users currently signed up and what role they have
- Scroll to the bottom of the bottom of the page
- Type in the student's name in the text box next to "Enter a user login"
- Ensure the "Participant" radio button is selected
- Select add
- Reaching assignment topics page
- Login as an instructor
- In the top red navigation bar, choose "Manage.."
- Select "Assignments" above the search bar
- Click the pencil button under actions column for any assignment
- Select the "Topics" tab
- Signing a student up
- Navigate to the assignment topics page
- Under the "Topic name(s)" column, click the checkmark for a given topic
- At the redirected page, type in an existing student user
- You should be redirected back to the "Edit Assignment" page, select the "Topics" tab to view your change
- Remove a team's signup from a topic
- Navigate to the assignment topics page
- Under the "Topic name(s)" column, click the x surrounded by a red circle for a given topic
- You should be redirected back to the "Edit Assignment" page, select the "Topics" tab to view your change
- Check to ensure a student can see his addition or removal from a topic
- Sign in as a student
- Select the assignment of interest on the home page
- The "your work" link should be grayed out with a message "(You have to choose a topic first) " if you've just removed the user's signup
- The "your work" link should be active if you've signed the user up
- Select the link "signup sheet"
- The topic you've signed the user up for should be highlighted in yellow
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:
<%= link_to image_tag('signup.png', :border => 0, :title => 'Sign Up Student', :align => 'middle'), signup_as_instructor_sign_up_sheet_index_path( assignment_id: params[:id], topic_id: topic.id) %>
<%= link_to image_tag('leave_topic.png', :border => 0, :title => 'Drop Student', :align => 'middle'), :controller => "sign_up_sheet", :action => "delete_signup_as_instructor", :id => participant.team_id, :topic_id => topic.id %>
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.
sign_up_sheet/signup_as_instructor.html.erb
<%= form_tag(:controller => "sign_up_sheet", :action => "signup_as_instructor_action",:topic_id => params[:topic_id], :assignment_id => params[:assignment_id]) do %>
<%= label_tag(:username, "Sign Up User:") %>
<%= text_field_tag(:username) %>
<%= hidden_field_tag "topic_id", params[:topic_id] %>
<%= hidden_field_tag "assignment_id", params[:assignment_id] %>
<%= submit_tag("Submit") %>
<% end %>
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])
if user.nil? # validate invalid user
flash[:error] = "That student does not exist!"
else
if AssignmentParticipant.exists? user_id: user.id, parent_id: params[:assignment_id]
if SignUpSheet.signup_team(params[:assignment_id], user.id, params[:topic_id])
flash[:success] = "You have successfully signed up the student for the topic!"
else
flash[:error] = "The student has already signed up for a topic!"
end
else
flash[:error] = "The student is not registered for the assignment!"
end
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)
team_user = TeamsUser.find_by(team_id: team.id)
user = User.find(team_user.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
Since we added new functionality, we needed to create new preconditions for testing the functionality. We describe the preconditions below. Rspec is utilized to perform the unit tests under the spec/controllers/sign_up_sheet_spec.rb file. We do not test the functionality of adding multiple students as this is tested in existing functionality that we utilized. We can assume that signing up a student will sign up the whole team as indicated by the contract with the existing function. The same contract exists for removing a student's sign up. We also wish to make a distinction in the goal of our functionality. It is not to remove one student from the team. It is to remove the whole team from a topic. Addition of too much extra functionality because it may be nice will clutter the system, thus we don't implement or test the addition or removal of an individual from a team since it is implemented elsewhere.
Preconditions
We create a three students and an instructor. We also create an assignment to which we add the three students as participants. Three teams are created with one user assigned to each team. The third team is created such that it has already submitted it's work. Three topics are created for the assignment with deadlines. The second and third teams are signed up for topics two and three. The instructor is to add the first student to topic one created for the assignment. The instructor is also to attempt to remove team two and three from being signed up. The objects are refreshed each time.
Test Description | Expected Result | Tested File | Method Tested |
---|---|---|---|
Add user to topic with no signed up team | Correct user is added to topic | sign_up_sheet_controller.rb | signup_as_instructor_action |
User already has a topic | flash[:error] = "The student has already signed up for a topic!" | sign_up_sheet_controller.rb | signup_as_instructor_action |
Username does not exist in database | flash[:error] = "The student does not exist!" | sign_up_sheet_controller.rb | signup_as_instructor_action |
User is registered for the assignment | flash[:error] = "The student is not registered for the assignment!" | sign_up_sheet_controller.rb | signup_as_instructor_action |
Redirect Signup | Redirects back to topic list page | sign_up_sheet_controller.rb | signup_as_instructor_action |
Don’t allow to delete signup if submitted | flash[:error] = "The student has already submitted their work, so you are not allowed to remove them." | sign_up_sheet_controller.rb | delete_signup_as_instructor |
Don’t allow delete signup with passed deadline | flash[:error] = "You cannot drop the student after the drop topic deadline!" | sign_up_sheet_controller.rb | delete_signup_as_instructor |
Redirect Delete Signup | Redirects back to topic list page | sign_up_sheet_controller.rb | delete_signup_as_instructor |