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 129: Line 129:
</p>
</p>
<br/>
<br/>
</pre>
====Issue3====
* ...........................................................................................
'''app/controllers/submitted_content_controller.rb:'''
<pre>
instructor = User.find(user.parent_id)
        bcc_mail_address = ""
        if instructor.copy_of_emails?
          bcc_mail_address = instructor.email
        else
          # do noting
        end
</pre>
<pre>
bcc: bcc_mail_address,
</pre>
====Issue4====
* ...........................................................................................
'''app/views/users/_prefs.html.erb:'''
* previous version:
<pre>
<td><label for="user_email_on_review">When someone else <strong>reviews</strong> my work</label></td>
            <td><%= check_box 'user', 'email_on_review', {},  true, false  %></td>
          </tr>
          <tr>
            <td><label for="user_email_on_submission">When someone else <strong>submits</strong> work I am assigned to review</label></td>
            <td><%= check_box 'user', 'email_on_submission', {},  true, false  %></td>
          </tr>
          <tr>
            <td><label for="user_email_on_review_of_review">When someone else reviews one of my reviews (<strong>metareviews</strong> my work)</label></td>
            <td><%= check_box 'user', 'email_on_review_of_review', {},  true, false %></td>
          </tr>
</pre>
* correct version:
<pre>
<tr>
            <td><label for="user_email_on_review">When someone else <strong>reviews</strong> my work</label></td>
            <td><%= check_box 'user', 'email_on_review'  %></td>
          </tr>
          <tr>
            <td><label for="user_email_on_submission">When someone else <strong>submits</strong> work I am assigned to review</label></td>
            <td><%= check_box 'user', 'email_on_submission'  %></td>
          </tr>
          <tr>
            <td><label for="user_email_on_review_of_review">When someone else reviews one of my reviews (<strong>metareviews</strong> my work)</label></td>
            <td><%= check_box 'user', 'email_on_review_of_review' %></td>
          </tr>
</pre>
</pre>



Revision as of 21:55, 25 October 2019

E1958. Two issues related to assignment management


Brief Introduction

  • E1961 Project aims to fix the problems of making the email notification function more reliable.

Problem Statement

The following tasks were accomplished in this project:

  • Issue1: Fix the problem that the author(reviewee) cannot receive the email notification about the review from someone else. The Expertiza is supposed to email authors each time a review of their work is submitted.
  • Issue2: Fix the bugs to make Expertiza emails reviewers each time an author that they have reviewed submits new work.


Issue1

  • Add a method in both "update" and "create" functions to call the email function to make the Experiza send the email to reviewee when reviewers submit the reviews
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

  • Add new function to email all reviewers a new submission is ready to review:
  • 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
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)
        instructor = User.find(user.parent_id)
        bcc_mail_address = ""
        if instructor.copy_of_emails?
          bcc_mail_address = instructor.email
        else
          # do noting
        end
        if user.email_on_submission?
          MailerHelper.send_mail_to_reviewer(user,
                                             bcc_mail_address,
                                             "You have a new submission to review",
                                             "update",
                                             "Please visit https://expertiza.ncsu.edu/response/edit?id=#{latest_response.id} and proceed to peer reviews.").deliver
        end
      end
    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