CSC/ECE 517 Fall 2019 - E1958. Two issues related to assignment management: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 52: Line 52:
</pre>
</pre>


'''app/helpers/assignment_helper.rb'''
<pre>
<pre>
def email_all_reviewers(participant)
    if participant.reviewers != []
      participant.reviewers.each do |reviewer|
        map = ReviewResponseMap.where(['reviewer_id = ? and reviewee_id = ?', reviewer.id, participant.team.id]).first
        responses = Response.where(:map_id => map.id)
        responses = responses.sort_by { |obj| obj.updated_at }
        # the latest response will be the last
        latest_response = responses.last
        # we need to pass the id of lastest_response in the URL mentioned in the mail.
        # this will open the correct /response/edit?id=#{latest_response.id} page for the reviewer when (s)he clicks on it.


        user = User.find(reviewer.user_id)
module AssignmentHelper
        instructor = User.find(user.parent_id)
  def course_options(instructor)
        bcc_mail_address = ""
    options = []
        if instructor.copy_of_emails?
    if session[:user].role.name == 'Teaching Assistant'
          bcc_mail_address = instructor.email
      courses = []
        else
      ta = Ta.find(session[:user].id)
          # do noting
      ta.ta_mappings.each {|mapping| courses << Course.find(mapping.course_id) }
        end
      # If a TA created some courses before, s/he can still add new assignments to these courses.
        if user.email_on_submission?
      #assigments =
          MailerHelper.send_mail_to_reviewer(user,
      #courses << Course.where(instructor_id: instructor.id)
                                            bcc_mail_address,
      courses.flatten!
                                            "You have a new submission to review",
    # Administrator and Super-Administrator can see all courses
                                            "update",
    elsif session[:user].role.name == 'Administrator' or session[:user].role.name == 'Super-Administrator'
                                            "Please visit https://expertiza.ncsu.edu/response/edit?id=#{latest_response.id} and proceed to peer reviews.").deliver
      options << ['-----------', nil]
        end
      courses = Course.all
       end
    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
     end
     end
  end
</pre>
</pre>



Revision as of 23:45, 28 October 2019

[[Media:File:Example.ogg[[File:--Pharida 16:57, 28 October 2019 (EDT)Example.jpg]]]]=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/controllers/response_controller.rb:

  def send_email_to_reviewee(map)
    defn = {body: {type: "Peer Review", partial_name: "new_submission"} }
    map.email(defn, Assignment.find(Participant.find(map.reviewer_id).parent_id))
  end


Issue2

  • Under the “General” tab of the assignment edit page, an instructor or a TA can change the course of an assignment.
  • In the first round, there is no reviewer before they take a request
  • ...........................................................
  • ...........................................................

app/controllers/submitted_content_controller.rb:

email_all_reviewers(@participant)
    end
    redirect_to action: 'edit', id: @participant.id
  end


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.
      #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
    end


app/helpers/mailer_helper.rb:

def self.send_mail_to_reviewer(user, bcc_mail_address, subject, partial_name, note)
    Mailer.new_review_request_message ({
        to: user.email,
        bcc: bcc_mail_address,
        subject: subject,
        body: {
            user: user,
            first_name: ApplicationHelper.get_user_first_name(user),
            message: note,
            partial_name: partial_name
        }
    })
  end

app/views/mailer/new_review_message.html.erb:

<!DOCTYPE html>
<html>
<head>
  <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
</head>
<body>
<%= render :partial => 'mailer/partials/'+@partial_name+'_html' %>

<hr>

This message has been generated by <A HREF="http://expertiza.ncsu.edu">Expertiza</A><BR/>
http://expertiza.ncsu.edu

</body>
</html>

app/views/mailer/partials/update.html.html.erb:


Hi <%= @first_name %>,</br>
<p>
  One of the assignments you are reviewing has just been entered or revised.
  "<%= @message %>"
</p>
<br/>

Process Video

Test

Team Information

  1. Siwei Wen (swen4@ncsu.edu)
  2. Shuzheng Wang (swang41@ncsu.edu)
  3. Zhifeng Zhu (zzhu25@ncsu.edu)
  4. Mentor: Ed Gehringer (efg@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