CSC/ECE 517 Fall 2019 - E1958. Two issues related to assignment management

From Expertiza_Wiki
Revision as of 00:24, 7 November 2019 by Pharida (talk | contribs)
Jump to navigation Jump to search

Introduction

Background

Expertiza has Assignment objects, which represent an assignment that is done by some number of users. An instructor or a TA can perform several kinds of operations on assignments, such as, ”Add participants”, “Create teams”, and “View scores”. These operations can be seen: First, on the homepage, under the “Actions” column in assignment list when a user (instructor or TA or admin) logs in and navigates to Manage -> Assignments.

Second, when editing an assignment (by clicking on edit logo above), on the tab called “Other stuff”.

Problem Statement

The following tasks were accomplished in this project:

  • Issue1: Implement a setting in the user’s (instructor/ TA) profile, from where the user can choose whether to see these actions on the homepage or in a tab associated with each assignment.
  • Issue2: Under the “General” tab of the assignment edit page, an instructor or a TA can change the course of an assignment.

What is wrong: A TA or an instructor can assign any course to an assignment even when they don't have access to the course. TAs can unassign an assignment from the course, and if they do so, they lose access to the assignment. What needs to be done:

Only those courses should be shown in the dropdown list of courses, the assignment is part of and the instructor or TA has access to. Instructors, but not TAs, would then be allowed to change an assignment to be part of no course. Also, change the name of the tab from “Other stuff” to “Etc.”.

Issue1

  • Implement a setting in the user’s (instructor/ TA) profile, from where the user can choose whether to see these actions on the homepage or in a tab associated with each assignment.

app/views/users/_editpreference.html.erb

<% request_user ||= false %>
<%if !request_user%>
    <div>
      <table class="table borderless">
        <tr>
          <th align='left'>Where do you want to see actions?</th>
        </tr>
        <tr>
          <!--<td><label for="user_preference_home_flag">On the homepage</label></td>-->
          <td><%= label_tag('user[preference_home_flag]', 'On the homepage')%></td>
          <td><%= check_box 'user', 'preference_home_flag', {},  true, false  %></td>
        </tr>
        <tr>
          <td><label for="user_preference_edit_flag">On the edit Assignment Page</label></td>
          <td><%= check_box 'user', 'preference_edit_flag', {},  true, false  %></td>
        </tr>
        <tr>
      </table>
    </div>
<% end %>


app/views/profile/edit.html.erb

<%= render :partial => 'users/editpreference' %>

Issue2

  • Under the “General” tab of the assignment edit page, an instructor or a TA can change the course of an assignment.


app/helpers/assignment_helper.rb


module AssignmentHelper
  def course_options(instructor)
    options = []
    if session[:user].role.name == 'Teaching Assistant'
      courses = []
      ta = Ta.find(session[:user].id)
      ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
      # If a TA created some courses before, s/he can still add new assignments to these courses.
      courses << Course.where(instructor_id: instructor.id)
      #assigments =
      #courses << Course.where(instructor_id: instructor.id)
      courses.flatten!
    # Administrator and Super-Administrator can see all courses
    elsif session[:user].role.name == 'Administrator' or session[:user].role.name == 'Super-Administrator'
      options << ['-----------', nil]
      courses = Course.all
    elsif session[:user].role.name == 'Instructor'
      options << ['-----------', nil]
      courses = Course.where(instructor_id: instructor.id)
      # instructor can see courses his/her TAs created
      ta_ids = []
      ta_ids << Instructor.get_my_tas(session[:user].id)
      ta_ids.flatten!
      ta_ids.each do |ta_id|
        ta = Ta.find(ta_id)
        ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
      end
      # ta_ids = []
      # ta_ids << Instructor.get_my_tas(session[:user].id)
      # ta_ids.flatten!
      # ta_ids.each do |ta_id|
      #   ta = Ta.find(ta_id)
      #   ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
      # end
    end
    options = []
    options << ['-----------', nil]


    courses.each do |course|
      options << [course.name, course.id]
    end

app/views/assignments/edit.html.erb


<li><a href="#tabs-8" id="Other">etc</a></li>


Process Video

Test

Team Information

  1. Parvathy Haridas Menon (pharida@ncsu.edu)
  2. Anmol Desai (adesai5@ncsu.edu)
  3. Suyash Jain (sjain26@ncsu.edu)

References

  1. Expertiza on GitHub
  2. The live Expertiza website
  3. Expertiza project documentation wiki
  4. GitHub Project Repository Fork
  5. Demo link
  6. Rspec Documentation