CSC/ECE 517 Spring 2017 E1714: Difference between revisions
(→signup_sheet_controller.rb: Update code) |
(→sign_up_sheet/_topic_name.html.erb: Update code) |
||
Line 104: | Line 104: | ||
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 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: | ||
<code> | <code> | ||
<%= 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 %> | |||
</code> | |||
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 === | |||
<code> | |||
<%= 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 %> | <% end %> | ||
</code> | </code> | ||
=== signup_sheet_controller.rb === | === signup_sheet_controller.rb === |
Revision as of 23:46, 31 March 2017
Motivation
Problem
For an instructor to sign up or drop teams from a topic, the instructor must first impersonate a student and then perform the necessary action. The current workflow introduces unnecessary complexity to the process. For adding or dropping multiple teams from topics, the workflow is quite cumbersome and involves changing between many pages.
Solutions
An instructor is able to view a list of all topics for a given an assignment and details about the topics. Each topic shows if a team is signed up for the topic, and if so which students are signed up or wait listed. The proposed change introduces a button next to each team of students that indicates removing that team from being signed up for the specific topic. In this manner, an instructor is more easily able to drop teams from topics. Along with the removal from signup, an instructor also has the option to sign a specific team up for a topic. The instructor is able to select the team by specifying one of the team members names. If the student specified by the instructor is not part of a team, current functionality creates a team for that student as part of the sign up process. To allow signing a team up, a new button was introduced in the topic name box which redirects to a new page. The new page allows the instructor to enter a student's name which should be signed up for the topic. Once added, the instructor is brought back to the previous edit assignment page where the student's team can be seen as signed up for the topic.
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 |
Username does not exist in database | flash[:error] = "The student does not exist!" | 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 | signup_as_instructor_action |
Redirect Signup | Redirects back to topic list page | Sign_up_sheet_controller.rb | delete_signup_as_instructor |