<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ckaidab</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ckaidab"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ckaidab"/>
	<updated>2026-05-06T12:49:22Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121234</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121234"/>
		<updated>2018-12-07T23:28:49Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach &amp;amp; Design ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for &amp;quot;similar_assignments&amp;quot; and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DB Design'''&lt;br /&gt;
&lt;br /&gt;
Currently, the Expertiza database design does not maintain any link between different assignments. An assignment of the current semester is completely independent of any other assignment of any other course having similar or exact objectives. For example, in a course C, the assignment named A1 in a semester Sx has no association to the same assignment given in an earlier semester Sy.&lt;br /&gt;
&lt;br /&gt;
Since our task involves using reviews from the past as samples for the present, we should create this association as a new table. Further, reviews may not be the only intention to associate assignments with each other, as future requirements might require associating them on other criteria too. Thus, we find it appropriate to name the table as &amp;quot;similar_assignments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The table structure is defined [http://wiki.expertiza.ncsu.edu/index.php/Similar_assignments here].&lt;br /&gt;
&lt;br /&gt;
This table can be visualized as a directed graph where vertices represent assignments. An edge (u,v) with a label L means u is similar to v for the intent of association, L.&lt;br /&gt;
&lt;br /&gt;
Consider a row (id = x, assignment_id = Ak, is_similar_for = An, association_intent = &amp;quot;review&amp;quot;). This means, given the intent of association as &amp;quot;review&amp;quot;, assignment Ak was chosen as a similar assignment for assignment An. That is, while marking some review for An as a sample, the instructor opted to have reviews of Ak as samples for An as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:UseCase.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Power Users:''' Instructors, TAs, Admins and Super Admins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''More details about each point mentioned in the approach section will be updated after the implementation.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
We have added a new column in the ‘responses’ table (in the database), namely, ‘visibility’. &lt;br /&gt;
Visibility can have 4 values as listed below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table showing list of visibility values and the properties&lt;br /&gt;
! Visibility &lt;br /&gt;
! Properties &lt;br /&gt;
|-&lt;br /&gt;
| 0 || Response is private. This is the default value.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 2 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || The response which was either in the review or approved earlier, has now been rejected as an example (it has been unmarked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We have maintained these constants in a new file at helpers/response_constants.rb.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ResponseConstants&lt;br /&gt;
	def _private&lt;br /&gt;
		0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def in_review&lt;br /&gt;
		1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def approved_as_sample&lt;br /&gt;
		2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def rejected_as_sample&lt;br /&gt;
		3&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the existing implementation of reviews, when a student starts a review (but hasn’t filled any text or ratings yet), a response gets created in the database. This response has a default visibility of 0.&lt;br /&gt;
&lt;br /&gt;
We have provided a checkbox (an HTML input node with attribute ‘type’ as ‘checkbox’) for the student to consent for his / her review to be used as an example, with values 0 and 1 for unchecked and checked respectively. This value is used to update the response object as part of the form submission.&lt;br /&gt;
&lt;br /&gt;
However, a student might want to remove their consent or give their consent, for a review that is already submitted. So, in the page where student views his / her own response, we have added the same HTML checkbox. On checking or unchecking the checkbox, the visibility field in the corresponding response object in the database gets updated.Consider this as case 1.&lt;br /&gt;
&lt;br /&gt;
Now when a power user looks at a review (at url , which is an HTML rendering of a ResponseMap containing Responses), he/she must be able to approve and reject responses which students have consented (offered) to be made visible to all. This is done by providing a button “Mark as Sample” or “Remove as Sample”. Responses without consent will not have any button.&lt;br /&gt;
&lt;br /&gt;
These HTML changes appear in views/popup/team_users_popup.html.haml&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if instance_variable_get('@sample_button_'+round.to_s)&lt;br /&gt;
        %div{:class=&amp;gt;'col-md-12 mark-delete-sample '+'round'+round.to_s}&lt;br /&gt;
          %h3{:class=&amp;gt;'col-md-10'} &amp;quot;Reviewed by #{User.find(@reviewer_id).fullname} (Round #{round})&amp;quot;&lt;br /&gt;
          %div{:class=&amp;gt;'col-md-2'}&lt;br /&gt;
&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@mark_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':2, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Mark as Sample&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@remove_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':3, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Remove as Sample&lt;br /&gt;
&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_fail_&amp;quot;+round.to_s}&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result success&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_success_&amp;quot;+round.to_s}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on “Mark as Sample” or “Unmark as Sample” changes the visibility of the response to 2 or 3 respectively. Like case 1 mentioned above, this is another situation where the visibility needs to be updated when there is a page event.&lt;br /&gt;
&lt;br /&gt;
Both these cases are event-based and require to make an HTTP request from the browser and handle the response while staying on the same page. Therefore, according to standard practice, an AJAX request must be initiated on click of the button or checkbox. The request needs two parameters - response id, and the updated value of visibility. User-identifying data is sent by default in HTTP header cookies (as in any usual HTTP request).&lt;br /&gt;
&lt;br /&gt;
To handle these requests, we have created a sample_reviews controller with a method update_visibility. Within the method, we first check whether the request parameters are valid, and then proceed to check whether the current user (identified by session id) should be allowed to edit the response object to the visibility value passed in the request.&lt;br /&gt;
&lt;br /&gt;
We have validated requests in this manner since HTTP is stateless and requests can easily be cloned (a browser need not be the only client making requests). For example, one could simply copy the request as a cURL, change the session id in the HTTP header to a student’s session, and pass alternative values of visibility (say 2, meaning, approved as a sample) in the request. Such requests should be identified as unauthorized requests, while requests which want to update visibility to a value that’s not allowed need to be rejected as bad requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def update_visibility&lt;br /&gt;
	begin&lt;br /&gt;
	visibility = params[:visibility] #response object consists of visibility in string format&lt;br /&gt;
	if(visibility.nil?)&lt;br /&gt;
	raise StandardError.new(&amp;quot;Missing parameter 'visibility'&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
	visibility = visibility.to_i&lt;br /&gt;
&lt;br /&gt;
	if not (_private..rejected_as_sample).include? visibility&lt;br /&gt;
		raise StandardError.new(&amp;quot;Invalid value for parameter 'visibility'&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	@@response_id = params[:id]&lt;br /&gt;
	response_map_id = Response.find(@@response_id).map_id&lt;br /&gt;
	response_map = ResponseMap.find(response_map_id)&lt;br /&gt;
	assignment_id = response_map.reviewed_object_id&lt;br /&gt;
	is_admin = [Role.administrator.id,Role.superadministrator.id].include? current_user.role.id&lt;br /&gt;
	if is_admin&lt;br /&gt;
		Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
		update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	course_id = Assignment.find(assignment_id).course_id&lt;br /&gt;
	instructor_id = Course.find(course_id).instructor_id&lt;br /&gt;
	ta_ids = []&lt;br /&gt;
	if current_user.role.id == Role.ta.id&lt;br /&gt;
	        ta_ids = TaMapping.where(course_id).ids # do this query only if current user is ta&lt;br /&gt;
	elsif current_user.role.id == Role.student.id&lt;br /&gt;
		# find if this student id is the same as the response reviewer id&lt;br /&gt;
		# and that visiblity is 0 or 1 and nothing else.&lt;br /&gt;
		# if anything fails, return failure&lt;br /&gt;
		if visibility &amp;gt; in_review&lt;br /&gt;
		           render json:{&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Not allowed&amp;quot;}&lt;br /&gt;
			        return&lt;br /&gt;
			    end&lt;br /&gt;
		reviewer_user_id = AssignmentParticipant.find(response_map.reviewer_id).user_id&lt;br /&gt;
		if reviewer_user_id != current_user.id&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
			 	return&lt;br /&gt;
		         end&lt;br /&gt;
&lt;br /&gt;
	elsif not ([instructor_id] + ta_ids).include? current_user.id&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
	update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		rescue StandardError =&amp;gt; e&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; e.message}&lt;br /&gt;
		else&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have provided a success or error message text below the button to indicate to the user that the request is completed.&lt;br /&gt;
&lt;br /&gt;
[[file: Mark unmark picssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have used the same request mark_unmark/:id with POST data as {“visibility”:x}, in the student view as well.&lt;br /&gt;
&lt;br /&gt;
This project also required that assignments be linked to each other, as explained in the sections above. To this end, we have created a controller, model, and a migration (to create the database table) for similar assignments.&lt;br /&gt;
&lt;br /&gt;
By default, every assignment is similar to itself (assume it’s id is X). So, after updating a response’s visibility, we add a new entry in the similar_assignments table: (assignment_id = X, similar_for = X, association_intent = “Review”). This addition is done only after confirming for non-existence, as one can infer from the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private&lt;br /&gt;
	def update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		if visibility == approved_as_sample&lt;br /&gt;
			ids = SimilarAssignment.where(:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			if ids.empty?&lt;br /&gt;
				SimilarAssignment.create({:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if visibility == rejected_as_sample or visibility == _private&lt;br /&gt;
			response_map_ids = ResponseMap.where(:reviewed_object_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			response_ids = Response.where(:map_id =&amp;gt; response_map_ids, :visibility =&amp;gt; approved_as_sample)&lt;br /&gt;
			if response_ids.empty?&lt;br /&gt;
				SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).destroy_all&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The power user visits a review response page expecting to mark some reviews as samples and then link or unlink the assignment associated with the review to his / her other assignments. To provide the linking functionality, we have provided a clickable text  “ Use as Samples for More Assignments” at the top right corner of the page as shown below.&lt;br /&gt;
&lt;br /&gt;
[[for use as sample for more assignment]]&lt;br /&gt;
&lt;br /&gt;
The appearance or non-appearance of this text is conditional. It only appears when there is at least one sample review for the current assignment. So, to decide this, we have queried for those assignments for which this assignment is a similar one, and checked on the size of the query result. The size is then checked in popup_controller to set an instance variable popup_show to a boolean value. The view uses this to render or not render the clickable “Use as Samples for More Assignments” text.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_similar_assignment_ids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def get_similar_assignment_ids(assignment_id)&lt;br /&gt;
      SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).pluck(:is_similar_for)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet of popup_controller line 84&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@page_size = popup_page_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On click of this text, we open a popup that lists out (with a checkbox alongside each list entry) the candidate assignments that this assignment can be similar for (these are unchecked), and assignments that it is already similar for (these are checked). For example, assume that the power user is viewing the response page of assignment X. Assume we have entries (X,Y,”review”) and (X,Z,”review”) in similar_assignments table. Then, the popup list will have the assignments Y and Z with a checkbox against each of them ticked, and all the other assignments that the current user has access to, with a checkbox against each of them unticked.&lt;br /&gt;
&lt;br /&gt;
The popup and the data that go with it are fetched on demand. So, the assignment list need not be a part of the first render of the page itself, as the inherent querying would slow down page load time. Therefore, on click, we fetch the list by an AJAX request (we have given appropriate error messages below the clickable text for the rare eventuality of any server-side error or empty response).&lt;br /&gt;
&lt;br /&gt;
This request GET “/similar_assignments/:id” is again authenticated in similar_assignments_controller, get method. Same validation ideas as explained earlier are used. Only the assignment’s course instructor and TAs, admin, and super-admin should be able to fetch this data, while others need not have access to it.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # GET /similar_assignments/:id&lt;br /&gt;
def get&lt;br /&gt;
    @assignment_id = params[:id]&lt;br /&gt;
    ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
    WHERE visibility=2 AND reviewed_object_id =&amp;quot;+@assignment_id.to_s).ids&lt;br /&gt;
    if ids.empty?&lt;br /&gt;
    render json: {&amp;quot;success&amp;quot;=&amp;gt;false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Please mark atleast one review as sample&amp;quot;}&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    begin&lt;br /&gt;
      if current_user.role.id == Role.student.id&lt;br /&gt;
        throw Exception.new&lt;br /&gt;
      end&lt;br /&gt;
    @similar_assignments = SimilarAssignment.where(:assignment_id =&amp;gt; @assignment_id).&lt;br /&gt;
    where.not(:is_similar_for=&amp;gt;@assignment_id).order(&amp;quot;created_at DESC&amp;quot;).pluck(:is_similar_for)&lt;br /&gt;
    rescue ActiveRecord::RecordNotFound =&amp;gt; e&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Resource not found&amp;quot;}&lt;br /&gt;
    rescue Exception&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unauthorized&amp;quot;}&lt;br /&gt;
    else&lt;br /&gt;
      @res = get_asssignments_set(@similar_assignments)&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;values&amp;quot; =&amp;gt; @res}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The get method fetches similar assignment ids and passes them on to get_asssignments_set of similar_assignments_helper. This method queries for all assignments (except the ones passed in its parameter list) that the current user is allowed to access and returns a list of hash objects which are used by the caller (the on-success function of the AJAX request). Each hash object contains assignment name, id, it’s course name, and whether it’s a similar assignment or not. Following code snippets demonstrates this:&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_asssignments_set method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_asssignments_set(selected)&lt;br /&gt;
    all_assignments = get_assignments_based_on_role&lt;br /&gt;
    assignment_array = []&lt;br /&gt;
    courses = get_courses_based_on_role&lt;br /&gt;
    all_assignments.each {&lt;br /&gt;
        |assignment|&lt;br /&gt;
      course_id = assignment.course_id&lt;br /&gt;
      if(course_id.nil?)&lt;br /&gt;
       next&lt;br /&gt;
      end&lt;br /&gt;
      if (selected.include? assignment.id)&lt;br /&gt;
        hash1 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; true, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash1)&lt;br /&gt;
      else&lt;br /&gt;
        hash2 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; false, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash2)&lt;br /&gt;
      end&lt;br /&gt;
    }&lt;br /&gt;
    return assignment_array&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_assignments_based_on_role method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_assignments_based_on_role()&lt;br /&gt;
    role = current_user.role.id&lt;br /&gt;
    page = params[:page]&lt;br /&gt;
    assignment_id = params[:id].to_i&lt;br /&gt;
    if page.nil?&lt;br /&gt;
      page = 0&lt;br /&gt;
    end&lt;br /&gt;
    _offset = page.to_i * popup_page_size&lt;br /&gt;
    case role&lt;br /&gt;
      when Role.ta.id&lt;br /&gt;
        course_ids = TaMapping.where(:ta_id =&amp;gt; current_user.id).pluck(:course_id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
          where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      when Role.instructor.id&lt;br /&gt;
        course_ids = Course.where(:instructor_id =&amp;gt; current_user.id).pluck(:id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
           where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        @all_assignments = []&lt;br /&gt;
    end&lt;br /&gt;
    @all_assignments&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The query result can be prohibitively large. This calls for pagination.&lt;br /&gt;
&lt;br /&gt;
Pagination at the server side is about performing the same query as a non-pagination implementation, with an addition: limit and offset. Limit denotes the size of a page, and offset denotes a start index, and is calculated as page size * page number. Page size is a constant defined in similar_assignments_constants.&lt;br /&gt;
&lt;br /&gt;
We had two options for response and rendering:&lt;br /&gt;
Construct the popup list HTML from the query results and respond with this HTML.&lt;br /&gt;
Respond with JSON, and build the HTML client side.&lt;br /&gt;
&lt;br /&gt;
Responding with HTML from server-side is expensive, as the byte size of the HTTP response would be significantly larger than JSON. Thus, we chose the second option.&lt;br /&gt;
&lt;br /&gt;
Since HTTP is stateless, the server has no way to maintain a running counter of page number. Therefore, keeping track of page number must be the responsibility of the client (browser JavaScript) who must pass it as a request parameter while the server simply reads it and assumes its lack of existence as page number 0. The following snippet demonstrates this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of response.js line 103-130&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fetchAssignments:function(){&lt;br /&gt;
    var self = this;&lt;br /&gt;
    var ajaxUrl = &amp;quot;/similar_assignments/&amp;quot;+assignmentId;&lt;br /&gt;
    if(this.currentPageNumber &amp;gt; 0){&lt;br /&gt;
        ajaxUrl += &amp;quot;?page=&amp;quot;+this.currentPageNumber;&lt;br /&gt;
    }&lt;br /&gt;
    jQuery.ajax({&lt;br /&gt;
        &amp;quot;url&amp;quot;:ajaxUrl,&lt;br /&gt;
        &amp;quot;type&amp;quot;:&amp;quot;GET&amp;quot;,&lt;br /&gt;
        &amp;quot;dataType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;responseType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;beforeSend&amp;quot;:function(){&lt;br /&gt;
            self.hideSuccess();&lt;br /&gt;
            self.hideError();&lt;br /&gt;
                    },&lt;br /&gt;
        &amp;quot;success&amp;quot;:function(result){&lt;br /&gt;
            if(result.success &amp;amp;&amp;amp; result.values.length){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }else if(result.success &amp;amp;&amp;amp; self.currentPageNumber == 0){&lt;br /&gt;
                self.onFetchFail(&amp;quot;Cannot link this to any assignment!&amp;quot;);&lt;br /&gt;
            }else if(result.success){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }&lt;br /&gt;
            else{&lt;br /&gt;
            self.onFetchFail(result.error);&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;failure&amp;quot;: self.onFetchFail,&lt;br /&gt;
        &amp;quot;error&amp;quot;:self.onFetchFail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have avoided maintaining the constant value of page size once on server side (in similar_assignments_constants) and once on the client side (JS variable). The initial render of the page creates a hidden HTML element that contains the page size, and once the document is ready, response.js selects that element, reads its value into a variable, and deletes that HTML element. This prevents having a page size in the HTML page-source, and more importantly, complies with the DRY principle. Page size should be changed in one function only - and that is in similar_assignments_constants as explained earlier.&lt;br /&gt;
&lt;br /&gt;
From the response JSON containing an array of objects (that are going to be rendered as list items), we have constructed the HTML list. Each list item maintains its assignment id in its HTML data attribute. The following snippet shows this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response.js lines 67-78&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addToList:function(assignment){&lt;br /&gt;
        var assignmentId = assignment.id;&lt;br /&gt;
        var title = assignment.title;&lt;br /&gt;
        var course = assignment.course_name;&lt;br /&gt;
        var displayText = &amp;quot;&amp;lt;strong&amp;gt;&amp;quot;+course+&amp;quot;: &amp;lt;/strong&amp;gt;&amp;quot; +title;&lt;br /&gt;
        var checked = assignment.checked;&lt;br /&gt;
        var newRow = this.template.clone();&lt;br /&gt;
        newRow.removeClass(&amp;quot;hide&amp;quot;).find(&amp;quot;input&amp;quot;).attr(&amp;quot;data-id&amp;quot;,assignmentId).attr(&amp;quot;checked&amp;quot;,checked);&lt;br /&gt;
        newRow.find(&amp;quot;span&amp;quot;).html(displayText).on(&amp;quot;click&amp;quot;,function(){&lt;br /&gt;
            newRow.find(&amp;quot;input&amp;quot;).click();&lt;br /&gt;
        });&lt;br /&gt;
        this.list.append(newRow.removeAttr(&amp;quot;id&amp;quot;));&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
_________________________________________A snapshot of the popup is shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The “More” button (shown in the snapshot above) is used to fetch the next set of results.&lt;br /&gt;
&lt;br /&gt;
After a finite number of requests, the client receives a lesser number of results than expected. This is when pagination must stop (since there are no more results). This is achieved by the object AssignmentsPopup (in our response.js file) - it maintains the page size and current page number. The more button is now replaced by a text “No more results” and it’s on-click functionality is turned off.&lt;br /&gt;
&lt;br /&gt;
______________________________________________Screenshot of popup with “No more results”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further, we have implemented this as a plug-and-play service. By reusing the same popup HTML and the AssignmentsPopup variable, the entire popup can be made a part of any Expertiza page.&lt;br /&gt;
&lt;br /&gt;
The page makes no requests on closing the popup, or on clicking Submit without checking any unchecked list item or unchecking any checked list item. It submits only if there is an overall difference in what items are checked and what are not.&lt;br /&gt;
&lt;br /&gt;
Click of “Submit” makes another AJAX POST request to “/similar_assignments/create/:id” with two params in the post JSON data:&lt;br /&gt;
“checked” - an array of assignment ids that were checked in the list but unchecked while opening the popup&lt;br /&gt;
“unchecked” - an array of assignment ids that were unchecked in the list but checked while opening the popup&lt;br /&gt;
&lt;br /&gt;
Either of these params may be empty, depending on the user’s actions, but not both (if both were empty, we simply close the popup without submitting). However, this optimization is only client side. Server side logic must still check for duplicates - that is, an assignment id under “checked” is already a part of similar_assignments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let current assignment id be X. For each of the checked assignment ids Ci in {C1,C2,...,Cn}, we have checked if there are entries (X,Ci) in similar_assignments table, and if not, then created that entry. Similarly, for each of the unchecked assignment ids Ui in {U1,U2,...,Um}, we have deleted the entry (X,Ui) from similar_assignments.&lt;br /&gt;
&lt;br /&gt;
On a successful update, the client closes the popup and prints a success message.&lt;br /&gt;
&lt;br /&gt;
_________________________________________________________________________________________Snapshot with success message&lt;br /&gt;
&lt;br /&gt;
So far, power users have marked reviews as samples and linked assignments. Now, students need to view these samples. A student would view these sample reviews before writing their review on somebody else’s work. Therefore, we have added a link “View Sample Reviews” to view the list of sample reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here.&amp;lt;pending&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, power users might also want to view samples. We have provided the same link on the following page too.&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here&lt;br /&gt;
&lt;br /&gt;
This page is rendered by the index method in sample_reviews_controller. It is a list of links to sample reviews. The layout of this page is common for users, as long as they are logged in. Non-logged-in or anonymous visitors are redirected to the Expertiza home page. ‘index’ calls a method redirect_anonymous_user in sample_reviews_helper to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of sample_reviews_helper&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def redirect_anonymous_user&lt;br /&gt;
    current_user = session[:user]&lt;br /&gt;
    if current_user.nil?&lt;br /&gt;
        redirect_to &amp;quot;/&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The list of available samples has no upper bound on its size. Yet again, pagination solves this problem. But unlike the case of the popup discussed earlier, the response type differs. A request without a ‘page’ parameter in its URL is a request for the web-page and should, therefore, render HTML, while the same request URL with the ‘page’ parameter is a request for more content, and should, therefore, render JSON. The following snippet from the index method demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample_reviews_controller - index method - add the if-else just before return statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def index&lt;br /&gt;
    redirect_anonymous_user&lt;br /&gt;
    @assignment_id = params[:id].to_i&lt;br /&gt;
    page_number = params[:page].to_i&lt;br /&gt;
    if page_number.nil?&lt;br /&gt;
        page_number = 0&lt;br /&gt;
    end&lt;br /&gt;
    @page_size = 8&lt;br /&gt;
    similar_assignment_ids = get_similar_assignment_ids(@assignment_id)&lt;br /&gt;
    @response_ids = []&lt;br /&gt;
    similar_assignment_ids.each do |id|&lt;br /&gt;
        _offset = page_number * @page_size&lt;br /&gt;
        ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
        WHERE visibility=2 AND reviewed_object_id = &amp;quot;+id.to_s+&lt;br /&gt;
        &amp;quot; ORDER BY responses.created_at LIMIT &amp;quot;+@page_size.to_s+&amp;quot; OFFSET &amp;quot;+_offset.to_s ).ids&lt;br /&gt;
        @response_ids += ids&lt;br /&gt;
    end&lt;br /&gt;
    @links = generate_links(@response_ids)&lt;br /&gt;
    if page_number == 0&lt;br /&gt;
        @course_assignment_name = get_course_assignment_name(@assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
        render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;sampleReviews&amp;quot; =&amp;gt; @links}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During this first render itself, we have also identified whether more results can exist. The “More” button only appears if the number of sample review links being rendered is equal to the page size, as shown in a snippet of views/sample_reviews/index.html.erb below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snip of Lines 12-15&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @links.size == @page_size %&amp;gt;&lt;br /&gt;
    &amp;lt;h5 style=&amp;quot;cursor:pointer;text-align: center;&amp;quot; id=&amp;quot;more_button&amp;quot;&amp;gt;More +&amp;lt;/h5&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clicking the “More” button now makes the same request as the page’s URL, but with the parameter ‘page’. In that case, the response is JSON, which is used by the caller (JavaScript Ajax) to add more rows to the page. If the number of rows is lesser than expected, the More text is changed, its click listener is turned off, and no more requests are made, demonstrated by the snippet of sample_review.js below.&lt;br /&gt;
&lt;br /&gt;
Code snip of Line 25-35&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i in result.sampleReviews)&lt;br /&gt;
{&lt;br /&gt;
    currentNumberOfRows++;&lt;br /&gt;
    var review = result.sampleReviews[i];&lt;br /&gt;
    var newRow = listTemplate.clone();&lt;br /&gt;
    newRow.removeClass(&amp;quot;hide&amp;quot;).removeAttr(&amp;quot;id&amp;quot;).find(&amp;quot;a&amp;quot;).&lt;br /&gt;
    html(&amp;quot;Sample Review &amp;quot;+currentNumberOfRows).attr(&amp;quot;href&amp;quot;,review);&lt;br /&gt;
    ulList.append(newRow);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if(responseSize &amp;lt; pageSize){&lt;br /&gt;
self.html(&amp;quot;No more results!&amp;quot;).off().css({&amp;quot;cursor&amp;quot;:&amp;quot;default&amp;quot;});&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
pageNumber++;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each of the list items on the page is a link, which takes the user to /sample_reviews/:id. On this page, we fetch the question-answer pairs corresponding to the object having the id given in the URL and print it out in the form of a table.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User (TA/Instructor/Admin/Super Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student, with a &amp;quot;Make as sample&amp;quot; button on the right of every review.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment task page is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to open the reviews summary page (at /student_review).&lt;br /&gt;
# Below the heading &amp;quot;Reviews for ...&amp;quot;, click on the &amp;quot;Show sample reviews&amp;quot; link.&lt;br /&gt;
# This opens a page where the student can view all sample reviews for that assignment.&lt;br /&gt;
# Use the browser's back button to go back to Assignment review page.&lt;br /&gt;
# Chose to review any of the teams' assignments that are displayed.&lt;br /&gt;
# Select a team for review and fill in the review.&lt;br /&gt;
# Before submitting the review, select the checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted has been made public.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RSpec Tests'''&lt;br /&gt;
&lt;br /&gt;
Below are the Rpsec tests that have been added to test the edge cases when a user tries to get access to the data using cloned requests:&lt;br /&gt;
# If an anonymous user tries to view the sample reviews page he/she will be redirected to home page.&lt;br /&gt;
# If an anonymous user tries to view the details of a particular sample review, he/she will be redirected to home page.&lt;br /&gt;
# If a user tries to view the sample review of a particular assignment for which there are no sample reviews, he/she will be redirected to home page.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121233</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121233"/>
		<updated>2018-12-07T23:28:17Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach &amp;amp; Design ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for &amp;quot;similar_assignments&amp;quot; and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DB Design'''&lt;br /&gt;
&lt;br /&gt;
Currently, the Expertiza database design does not maintain any link between different assignments. An assignment of the current semester is completely independent of any other assignment of any other course having similar or exact objectives. For example, in a course C, the assignment named A1 in a semester Sx has no association to the same assignment given in an earlier semester Sy.&lt;br /&gt;
&lt;br /&gt;
Since our task involves using reviews from the past as samples for the present, we should create this association as a new table. Further, reviews may not be the only intention to associate assignments with each other, as future requirements might require associating them on other criteria too. Thus, we find it appropriate to name the table as &amp;quot;similar_assignments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The table structure is defined [http://wiki.expertiza.ncsu.edu/index.php/Similar_assignments here].&lt;br /&gt;
&lt;br /&gt;
This table can be visualized as a directed graph where vertices represent assignments. An edge (u,v) with a label L means u is similar to v for the intent of association, L.&lt;br /&gt;
&lt;br /&gt;
Consider a row (id = x, assignment_id = Ak, is_similar_for = An, association_intent = &amp;quot;review&amp;quot;). This means, given the intent of association as &amp;quot;review&amp;quot;, assignment Ak was chosen as a similar assignment for assignment An. That is, while marking some review for An as a sample, the instructor opted to have reviews of Ak as samples for An as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:UseCase.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Power Users:''' Instructors, TAs, Admins and Super Admins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''More details about each point mentioned in the approach section will be updated after the implementation.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
We have added a new column in the ‘responses’ table (in the database), namely, ‘visibility’. &lt;br /&gt;
Visibility can have 4 values as listed below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table showing list of visibility values and the properties&lt;br /&gt;
! Visibility &lt;br /&gt;
! Properties &lt;br /&gt;
|-&lt;br /&gt;
| 0 || Response is private. This is the default value.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 2 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || The response which was either in the review or approved earlier, has now been rejected as an example (it has been unmarked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We have maintained these constants in a new file at helpers/response_constants.rb.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ResponseConstants&lt;br /&gt;
	def _private&lt;br /&gt;
		0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def in_review&lt;br /&gt;
		1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def approved_as_sample&lt;br /&gt;
		2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def rejected_as_sample&lt;br /&gt;
		3&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the existing implementation of reviews, when a student starts a review (but hasn’t filled any text or ratings yet), a response gets created in the database. This response has a default visibility of 0.&lt;br /&gt;
&lt;br /&gt;
We have provided a checkbox (an HTML input node with attribute ‘type’ as ‘checkbox’) for the student to consent for his / her review to be used as an example, with values 0 and 1 for unchecked and checked respectively. This value is used to update the response object as part of the form submission.&lt;br /&gt;
&lt;br /&gt;
However, a student might want to remove their consent or give their consent, for a review that is already submitted. So, in the page where student views his / her own response, we have added the same HTML checkbox. On checking or unchecking the checkbox, the visibility field in the corresponding response object in the database gets updated.Consider this as case 1.&lt;br /&gt;
&lt;br /&gt;
Now when a power user looks at a review (at url , which is an HTML rendering of a ResponseMap containing Responses), he/she must be able to approve and reject responses which students have consented (offered) to be made visible to all. This is done by providing a button “Mark as Sample” or “Remove as Sample”. Responses without consent will not have any button.&lt;br /&gt;
&lt;br /&gt;
These HTML changes appear in views/popup/team_users_popup.html.haml&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if instance_variable_get('@sample_button_'+round.to_s)&lt;br /&gt;
        %div{:class=&amp;gt;'col-md-12 mark-delete-sample '+'round'+round.to_s}&lt;br /&gt;
          %h3{:class=&amp;gt;'col-md-10'} &amp;quot;Reviewed by #{User.find(@reviewer_id).fullname} (Round #{round})&amp;quot;&lt;br /&gt;
          %div{:class=&amp;gt;'col-md-2'}&lt;br /&gt;
&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@mark_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':2, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Mark as Sample&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@remove_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':3, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Remove as Sample&lt;br /&gt;
&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_fail_&amp;quot;+round.to_s}&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result success&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_success_&amp;quot;+round.to_s}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on “Mark as Sample” or “Unmark as Sample” changes the visibility of the response to 2 or 3 respectively. Like case 1 mentioned above, this is another situation where the visibility needs to be updated when there is a page event.&lt;br /&gt;
&lt;br /&gt;
Both these cases are event-based and require to make an HTTP request from the browser and handle the response while staying on the same page. Therefore, according to standard practice, an AJAX request must be initiated on click of the button or checkbox. The request needs two parameters - response id, and the updated value of visibility. User-identifying data is sent by default in HTTP header cookies (as in any usual HTTP request).&lt;br /&gt;
&lt;br /&gt;
To handle these requests, we have created a sample_reviews controller with a method update_visibility. Within the method, we first check whether the request parameters are valid, and then proceed to check whether the current user (identified by session id) should be allowed to edit the response object to the visibility value passed in the request.&lt;br /&gt;
&lt;br /&gt;
We have validated requests in this manner since HTTP is stateless and requests can easily be cloned (a browser need not be the only client making requests). For example, one could simply copy the request as a cURL, change the session id in the HTTP header to a student’s session, and pass alternative values of visibility (say 2, meaning, approved as a sample) in the request. Such requests should be identified as unauthorized requests, while requests which want to update visibility to a value that’s not allowed need to be rejected as bad requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def update_visibility&lt;br /&gt;
	begin&lt;br /&gt;
	visibility = params[:visibility] #response object consists of visibility in string format&lt;br /&gt;
	if(visibility.nil?)&lt;br /&gt;
	raise StandardError.new(&amp;quot;Missing parameter 'visibility'&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
	visibility = visibility.to_i&lt;br /&gt;
&lt;br /&gt;
	if not (_private..rejected_as_sample).include? visibility&lt;br /&gt;
		raise StandardError.new(&amp;quot;Invalid value for parameter 'visibility'&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	@@response_id = params[:id]&lt;br /&gt;
	response_map_id = Response.find(@@response_id).map_id&lt;br /&gt;
	response_map = ResponseMap.find(response_map_id)&lt;br /&gt;
	assignment_id = response_map.reviewed_object_id&lt;br /&gt;
	is_admin = [Role.administrator.id,Role.superadministrator.id].include? current_user.role.id&lt;br /&gt;
	if is_admin&lt;br /&gt;
		Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
		update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	course_id = Assignment.find(assignment_id).course_id&lt;br /&gt;
	instructor_id = Course.find(course_id).instructor_id&lt;br /&gt;
	ta_ids = []&lt;br /&gt;
	if current_user.role.id == Role.ta.id&lt;br /&gt;
	        ta_ids = TaMapping.where(course_id).ids # do this query only if current user is ta&lt;br /&gt;
	elsif current_user.role.id == Role.student.id&lt;br /&gt;
		# find if this student id is the same as the response reviewer id&lt;br /&gt;
		# and that visiblity is 0 or 1 and nothing else.&lt;br /&gt;
		# if anything fails, return failure&lt;br /&gt;
		if visibility &amp;gt; in_review&lt;br /&gt;
		           render json:{&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Not allowed&amp;quot;}&lt;br /&gt;
			        return&lt;br /&gt;
			    end&lt;br /&gt;
		reviewer_user_id = AssignmentParticipant.find(response_map.reviewer_id).user_id&lt;br /&gt;
		if reviewer_user_id != current_user.id&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
			 	return&lt;br /&gt;
		         end&lt;br /&gt;
&lt;br /&gt;
	elsif not ([instructor_id] + ta_ids).include? current_user.id&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
	update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		rescue StandardError =&amp;gt; e&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; e.message}&lt;br /&gt;
		else&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have provided a success or error message text below the button to indicate to the user that the request is completed.&lt;br /&gt;
&lt;br /&gt;
[[file: Mark unmark picssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have used the same request mark_unmark/:id with POST data as {“visibility”:x}, in the student view as well.&lt;br /&gt;
&lt;br /&gt;
This project also required that assignments be linked to each other, as explained in the sections above. To this end, we have created a controller, model, and a migration (to create the database table) for similar assignments.&lt;br /&gt;
&lt;br /&gt;
By default, every assignment is similar to itself (assume it’s id is X). So, after updating a response’s visibility, we add a new entry in the similar_assignments table: (assignment_id = X, similar_for = X, association_intent = “Review”). This addition is done only after confirming for non-existence, as one can infer from the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private&lt;br /&gt;
	def update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		if visibility == approved_as_sample&lt;br /&gt;
			ids = SimilarAssignment.where(:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			if ids.empty?&lt;br /&gt;
				SimilarAssignment.create({:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if visibility == rejected_as_sample or visibility == _private&lt;br /&gt;
			response_map_ids = ResponseMap.where(:reviewed_object_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			response_ids = Response.where(:map_id =&amp;gt; response_map_ids, :visibility =&amp;gt; approved_as_sample)&lt;br /&gt;
			if response_ids.empty?&lt;br /&gt;
				SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).destroy_all&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The power user visits a review response page expecting to mark some reviews as samples and then link or unlink the assignment associated with the review to his / her other assignments. To provide the linking functionality, we have provided a clickable text  “ Use as Samples for More Assignments” at the top right corner of the page as shown below.&lt;br /&gt;
&lt;br /&gt;
[[for use as sample for more assignment]]&lt;br /&gt;
&lt;br /&gt;
The appearance or non-appearance of this text is conditional. It only appears when there is at least one sample review for the current assignment. So, to decide this, we have queried for those assignments for which this assignment is a similar one, and checked on the size of the query result. The size is then checked in popup_controller to set an instance variable popup_show to a boolean value. The view uses this to render or not render the clickable “Use as Samples for More Assignments” text.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_similar_assignment_ids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def get_similar_assignment_ids(assignment_id)&lt;br /&gt;
      SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).pluck(:is_similar_for)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet of popup_controller line 84&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@page_size = popup_page_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On click of this text, we open a popup that lists out (with a checkbox alongside each list entry) the candidate assignments that this assignment can be similar for (these are unchecked), and assignments that it is already similar for (these are checked). For example, assume that the power user is viewing the response page of assignment X. Assume we have entries (X,Y,”review”) and (X,Z,”review”) in similar_assignments table. Then, the popup list will have the assignments Y and Z with a checkbox against each of them ticked, and all the other assignments that the current user has access to, with a checkbox against each of them unticked.&lt;br /&gt;
&lt;br /&gt;
The popup and the data that go with it are fetched on demand. So, the assignment list need not be a part of the first render of the page itself, as the inherent querying would slow down page load time. Therefore, on click, we fetch the list by an AJAX request (we have given appropriate error messages below the clickable text for the rare eventuality of any server-side error or empty response).&lt;br /&gt;
&lt;br /&gt;
This request GET “/similar_assignments/:id” is again authenticated in similar_assignments_controller, get method. Same validation ideas as explained earlier are used. Only the assignment’s course instructor and TAs, admin, and super-admin should be able to fetch this data, while others need not have access to it.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # GET /similar_assignments/:id&lt;br /&gt;
def get&lt;br /&gt;
    @assignment_id = params[:id]&lt;br /&gt;
    ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
    WHERE visibility=2 AND reviewed_object_id =&amp;quot;+@assignment_id.to_s).ids&lt;br /&gt;
    if ids.empty?&lt;br /&gt;
    render json: {&amp;quot;success&amp;quot;=&amp;gt;false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Please mark atleast one review as sample&amp;quot;}&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    begin&lt;br /&gt;
      if current_user.role.id == Role.student.id&lt;br /&gt;
        throw Exception.new&lt;br /&gt;
      end&lt;br /&gt;
    @similar_assignments = SimilarAssignment.where(:assignment_id =&amp;gt; @assignment_id).&lt;br /&gt;
    where.not(:is_similar_for=&amp;gt;@assignment_id).order(&amp;quot;created_at DESC&amp;quot;).pluck(:is_similar_for)&lt;br /&gt;
    rescue ActiveRecord::RecordNotFound =&amp;gt; e&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Resource not found&amp;quot;}&lt;br /&gt;
    rescue Exception&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unauthorized&amp;quot;}&lt;br /&gt;
    else&lt;br /&gt;
      @res = get_asssignments_set(@similar_assignments)&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;values&amp;quot; =&amp;gt; @res}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The get method fetches similar assignment ids and passes them on to get_asssignments_set of similar_assignments_helper. This method queries for all assignments (except the ones passed in its parameter list) that the current user is allowed to access and returns a list of hash objects which are used by the caller (the on-success function of the AJAX request). Each hash object contains assignment name, id, it’s course name, and whether it’s a similar assignment or not. Following code snippets demonstrates this:&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_asssignments_set method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_asssignments_set(selected)&lt;br /&gt;
    all_assignments = get_assignments_based_on_role&lt;br /&gt;
    assignment_array = []&lt;br /&gt;
    courses = get_courses_based_on_role&lt;br /&gt;
    all_assignments.each {&lt;br /&gt;
        |assignment|&lt;br /&gt;
      course_id = assignment.course_id&lt;br /&gt;
      if(course_id.nil?)&lt;br /&gt;
       next&lt;br /&gt;
      end&lt;br /&gt;
      if (selected.include? assignment.id)&lt;br /&gt;
        hash1 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; true, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash1)&lt;br /&gt;
      else&lt;br /&gt;
        hash2 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; false, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash2)&lt;br /&gt;
      end&lt;br /&gt;
    }&lt;br /&gt;
    return assignment_array&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_assignments_based_on_role method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_assignments_based_on_role()&lt;br /&gt;
    role = current_user.role.id&lt;br /&gt;
    page = params[:page]&lt;br /&gt;
    assignment_id = params[:id].to_i&lt;br /&gt;
    if page.nil?&lt;br /&gt;
      page = 0&lt;br /&gt;
    end&lt;br /&gt;
    _offset = page.to_i * popup_page_size&lt;br /&gt;
    case role&lt;br /&gt;
      when Role.ta.id&lt;br /&gt;
        course_ids = TaMapping.where(:ta_id =&amp;gt; current_user.id).pluck(:course_id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
          where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      when Role.instructor.id&lt;br /&gt;
        course_ids = Course.where(:instructor_id =&amp;gt; current_user.id).pluck(:id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
           where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        @all_assignments = []&lt;br /&gt;
    end&lt;br /&gt;
    @all_assignments&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The query result can be prohibitively large. This calls for pagination.&lt;br /&gt;
&lt;br /&gt;
Pagination at the server side is about performing the same query as a non-pagination implementation, with an addition: limit and offset. Limit denotes the size of a page, and offset denotes a start index, and is calculated as page size * page number. Page size is a constant defined in similar_assignments_constants.&lt;br /&gt;
&lt;br /&gt;
We had two options for response and rendering:&lt;br /&gt;
Construct the popup list HTML from the query results and respond with this HTML.&lt;br /&gt;
Respond with JSON, and build the HTML client side.&lt;br /&gt;
&lt;br /&gt;
Responding with HTML from server-side is expensive, as the byte size of the HTTP response would be significantly larger than JSON. Thus, we chose the second option.&lt;br /&gt;
&lt;br /&gt;
Since HTTP is stateless, the server has no way to maintain a running counter of page number. Therefore, keeping track of page number must be the responsibility of the client (browser JavaScript) who must pass it as a request parameter while the server simply reads it and assumes its lack of existence as page number 0. The following snippet demonstrates this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of response.js line 103-130&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fetchAssignments:function(){&lt;br /&gt;
    var self = this;&lt;br /&gt;
    var ajaxUrl = &amp;quot;/similar_assignments/&amp;quot;+assignmentId;&lt;br /&gt;
    if(this.currentPageNumber &amp;gt; 0){&lt;br /&gt;
        ajaxUrl += &amp;quot;?page=&amp;quot;+this.currentPageNumber;&lt;br /&gt;
    }&lt;br /&gt;
    jQuery.ajax({&lt;br /&gt;
        &amp;quot;url&amp;quot;:ajaxUrl,&lt;br /&gt;
        &amp;quot;type&amp;quot;:&amp;quot;GET&amp;quot;,&lt;br /&gt;
        &amp;quot;dataType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;responseType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;beforeSend&amp;quot;:function(){&lt;br /&gt;
            self.hideSuccess();&lt;br /&gt;
            self.hideError();&lt;br /&gt;
                    },&lt;br /&gt;
        &amp;quot;success&amp;quot;:function(result){&lt;br /&gt;
            if(result.success &amp;amp;&amp;amp; result.values.length){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }else if(result.success &amp;amp;&amp;amp; self.currentPageNumber == 0){&lt;br /&gt;
                self.onFetchFail(&amp;quot;Cannot link this to any assignment!&amp;quot;);&lt;br /&gt;
            }else if(result.success){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }&lt;br /&gt;
            else{&lt;br /&gt;
            self.onFetchFail(result.error);&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;failure&amp;quot;: self.onFetchFail,&lt;br /&gt;
        &amp;quot;error&amp;quot;:self.onFetchFail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have avoided maintaining the constant value of page size once on server side (in similar_assignments_constants) and once on the client side (JS variable). The initial render of the page creates a hidden HTML element that contains the page size, and once the document is ready, response.js selects that element, reads its value into a variable, and deletes that HTML element. This prevents having a page size in the HTML page-source, and more importantly, complies with the DRY principle. Page size should be changed in one function only - and that is in similar_assignments_constants as explained earlier.&lt;br /&gt;
&lt;br /&gt;
From the response JSON containing an array of objects (that are going to be rendered as list items), we have constructed the HTML list. Each list item maintains its assignment id in its HTML data attribute. The following snippet shows this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response.js lines 67-78&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addToList:function(assignment){&lt;br /&gt;
        var assignmentId = assignment.id;&lt;br /&gt;
        var title = assignment.title;&lt;br /&gt;
        var course = assignment.course_name;&lt;br /&gt;
        var displayText = &amp;quot;&amp;lt;strong&amp;gt;&amp;quot;+course+&amp;quot;: &amp;lt;/strong&amp;gt;&amp;quot; +title;&lt;br /&gt;
        var checked = assignment.checked;&lt;br /&gt;
        var newRow = this.template.clone();&lt;br /&gt;
        newRow.removeClass(&amp;quot;hide&amp;quot;).find(&amp;quot;input&amp;quot;).attr(&amp;quot;data-id&amp;quot;,assignmentId).attr(&amp;quot;checked&amp;quot;,checked);&lt;br /&gt;
        newRow.find(&amp;quot;span&amp;quot;).html(displayText).on(&amp;quot;click&amp;quot;,function(){&lt;br /&gt;
            newRow.find(&amp;quot;input&amp;quot;).click();&lt;br /&gt;
        });&lt;br /&gt;
        this.list.append(newRow.removeAttr(&amp;quot;id&amp;quot;));&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
_________________________________________A snapshot of the popup is shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The “More” button (shown in the snapshot above) is used to fetch the next set of results.&lt;br /&gt;
&lt;br /&gt;
After a finite number of requests, the client receives a lesser number of results than expected. This is when pagination must stop (since there are no more results). This is achieved by the object AssignmentsPopup (in our response.js file) - it maintains the page size and current page number. The more button is now replaced by a text “No more results” and it’s on-click functionality is turned off.&lt;br /&gt;
&lt;br /&gt;
______________________________________________Screenshot of popup with “No more results”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further, we have implemented this as a plug-and-play service. By reusing the same popup HTML and the AssignmentsPopup variable, the entire popup can be made a part of any Expertiza page.&lt;br /&gt;
&lt;br /&gt;
The page makes no requests on closing the popup, or on clicking Submit without checking any unchecked list item or unchecking any checked list item. It submits only if there is an overall difference in what items are checked and what are not.&lt;br /&gt;
&lt;br /&gt;
Click of “Submit” makes another AJAX POST request to “/similar_assignments/create/:id” with two params in the post JSON data:&lt;br /&gt;
“checked” - an array of assignment ids that were checked in the list but unchecked while opening the popup&lt;br /&gt;
“unchecked” - an array of assignment ids that were unchecked in the list but checked while opening the popup&lt;br /&gt;
&lt;br /&gt;
Either of these params may be empty, depending on the user’s actions, but not both (if both were empty, we simply close the popup without submitting). However, this optimization is only client side. Server side logic must still check for duplicates - that is, an assignment id under “checked” is already a part of similar_assignments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let current assignment id be X. For each of the checked assignment ids Ci in {C1,C2,...,Cn}, we have checked if there are entries (X,Ci) in similar_assignments table, and if not, then created that entry. Similarly, for each of the unchecked assignment ids Ui in {U1,U2,...,Um}, we have deleted the entry (X,Ui) from similar_assignments.&lt;br /&gt;
&lt;br /&gt;
On a successful update, the client closes the popup and prints a success message.&lt;br /&gt;
&lt;br /&gt;
_________________________________________________________________________________________Snapshot with success message&lt;br /&gt;
&lt;br /&gt;
So far, power users have marked reviews as samples and linked assignments. Now, students need to view these samples. A student would view these sample reviews before writing their review on somebody else’s work. Therefore, we have added a link “View Sample Reviews” to view the list of sample reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here.&amp;lt;pending&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, power users might also want to view samples. We have provided the same link on the following page too.&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here&lt;br /&gt;
&lt;br /&gt;
This page is rendered by the index method in sample_reviews_controller. It is a list of links to sample reviews. The layout of this page is common for users, as long as they are logged in. Non-logged-in or anonymous visitors are redirected to the Expertiza home page. ‘index’ calls a method redirect_anonymous_user in sample_reviews_helper to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of sample_reviews_helper&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def redirect_anonymous_user&lt;br /&gt;
    current_user = session[:user]&lt;br /&gt;
    if current_user.nil?&lt;br /&gt;
        redirect_to &amp;quot;/&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The list of available samples has no upper bound on its size. Yet again, pagination solves this problem. But unlike the case of the popup discussed earlier, the response type differs. A request without a ‘page’ parameter in its URL is a request for the web-page and should, therefore, render HTML, while the same request URL with the ‘page’ parameter is a request for more content, and should, therefore, render JSON. The following snippet from the index method demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample_reviews_controller - index method - add the if-else just before return statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def index&lt;br /&gt;
    redirect_anonymous_user&lt;br /&gt;
    @assignment_id = params[:id].to_i&lt;br /&gt;
    page_number = params[:page].to_i&lt;br /&gt;
    if page_number.nil?&lt;br /&gt;
        page_number = 0&lt;br /&gt;
    end&lt;br /&gt;
    @page_size = 8&lt;br /&gt;
    similar_assignment_ids = get_similar_assignment_ids(@assignment_id)&lt;br /&gt;
    @response_ids = []&lt;br /&gt;
    similar_assignment_ids.each do |id|&lt;br /&gt;
        _offset = page_number * @page_size&lt;br /&gt;
        ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
        WHERE visibility=2 AND reviewed_object_id = &amp;quot;+id.to_s+&lt;br /&gt;
        &amp;quot; ORDER BY responses.created_at LIMIT &amp;quot;+@page_size.to_s+&amp;quot; OFFSET &amp;quot;+_offset.to_s ).ids&lt;br /&gt;
        @response_ids += ids&lt;br /&gt;
    end&lt;br /&gt;
    @links = generate_links(@response_ids)&lt;br /&gt;
    if page_number == 0&lt;br /&gt;
        @course_assignment_name = get_course_assignment_name(@assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
        render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;sampleReviews&amp;quot; =&amp;gt; @links}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During this first render itself, we have also identified whether more results can exist. The “More” button only appears if the number of sample review links being rendered is equal to the page size, as shown in a snippet of views/sample_reviews/index.html.erb below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snip of Lines 12-15&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @links.size == @page_size %&amp;gt;&lt;br /&gt;
    &amp;lt;h5 style=&amp;quot;cursor:pointer;text-align: center;&amp;quot; id=&amp;quot;more_button&amp;quot;&amp;gt;More +&amp;lt;/h5&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clicking the “More” button now makes the same request as the page’s URL, but with the parameter ‘page’. In that case, the response is JSON, which is used by the caller (JavaScript Ajax) to add more rows to the page. If the number of rows is lesser than expected, the More text is changed, its click listener is turned off, and no more requests are made, demonstrated by the snippet of sample_review.js below.&lt;br /&gt;
&lt;br /&gt;
Code snip of Line 25-35&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i in result.sampleReviews)&lt;br /&gt;
{&lt;br /&gt;
    currentNumberOfRows++;&lt;br /&gt;
    var review = result.sampleReviews[i];&lt;br /&gt;
    var newRow = listTemplate.clone();&lt;br /&gt;
    newRow.removeClass(&amp;quot;hide&amp;quot;).removeAttr(&amp;quot;id&amp;quot;).find(&amp;quot;a&amp;quot;).&lt;br /&gt;
    html(&amp;quot;Sample Review &amp;quot;+currentNumberOfRows).attr(&amp;quot;href&amp;quot;,review);&lt;br /&gt;
    ulList.append(newRow);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if(responseSize &amp;lt; pageSize){&lt;br /&gt;
self.html(&amp;quot;No more results!&amp;quot;).off().css({&amp;quot;cursor&amp;quot;:&amp;quot;default&amp;quot;});&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
pageNumber++;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each of the list items on the page is a link, which takes the user to /sample_reviews/:id. On this page, we fetch the question-answer pairs corresponding to the object having the id given in the URL and print it out in the form of a table.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User (TA/Instructor/Admin/Super Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student, with a &amp;quot;Make as sample&amp;quot; button on the right of every review.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment task page is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to open the reviews summary page (at /student_review).&lt;br /&gt;
# Below the heading &amp;quot;Reviews for ...&amp;quot;, click on the &amp;quot;Show sample reviews&amp;quot; link.&lt;br /&gt;
# This opens a page where the student can view all sample reviews for that assignment.&lt;br /&gt;
# Use the browser's back button to go back to Assignment review page.&lt;br /&gt;
# Chose to review any of the teams' assignments that are displayed.&lt;br /&gt;
# Select a team for review and fill in the review.&lt;br /&gt;
# Before submitting the review, select the checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted has been made public.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RSpec Tests'''&lt;br /&gt;
''Below are the Rpsec tests that have been added to test the edge cases when a user tries to get access to the data using cloned requests:''&lt;br /&gt;
# If an anonymous user tries to view the sample reviews page he/she will be redirected to home page.&lt;br /&gt;
# If an anonymous user tries to view the details of a particular sample review, he/she will be redirected to home page.&lt;br /&gt;
# If a user tries to view the sample review of a particular assignment for which there are no sample reviews, he/she will be redirected to home page.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121232</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121232"/>
		<updated>2018-12-07T23:27:31Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach &amp;amp; Design ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for &amp;quot;similar_assignments&amp;quot; and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DB Design'''&lt;br /&gt;
&lt;br /&gt;
Currently, the Expertiza database design does not maintain any link between different assignments. An assignment of the current semester is completely independent of any other assignment of any other course having similar or exact objectives. For example, in a course C, the assignment named A1 in a semester Sx has no association to the same assignment given in an earlier semester Sy.&lt;br /&gt;
&lt;br /&gt;
Since our task involves using reviews from the past as samples for the present, we should create this association as a new table. Further, reviews may not be the only intention to associate assignments with each other, as future requirements might require associating them on other criteria too. Thus, we find it appropriate to name the table as &amp;quot;similar_assignments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The table structure is defined [http://wiki.expertiza.ncsu.edu/index.php/Similar_assignments here].&lt;br /&gt;
&lt;br /&gt;
This table can be visualized as a directed graph where vertices represent assignments. An edge (u,v) with a label L means u is similar to v for the intent of association, L.&lt;br /&gt;
&lt;br /&gt;
Consider a row (id = x, assignment_id = Ak, is_similar_for = An, association_intent = &amp;quot;review&amp;quot;). This means, given the intent of association as &amp;quot;review&amp;quot;, assignment Ak was chosen as a similar assignment for assignment An. That is, while marking some review for An as a sample, the instructor opted to have reviews of Ak as samples for An as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:UseCase.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Power Users:''' Instructors, TAs, Admins and Super Admins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''More details about each point mentioned in the approach section will be updated after the implementation.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
We have added a new column in the ‘responses’ table (in the database), namely, ‘visibility’. &lt;br /&gt;
Visibility can have 4 values as listed below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table showing list of visibility values and the properties&lt;br /&gt;
! Visibility &lt;br /&gt;
! Properties &lt;br /&gt;
|-&lt;br /&gt;
| 0 || Response is private. This is the default value.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 2 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || The response which was either in the review or approved earlier, has now been rejected as an example (it has been unmarked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We have maintained these constants in a new file at helpers/response_constants.rb.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ResponseConstants&lt;br /&gt;
	def _private&lt;br /&gt;
		0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def in_review&lt;br /&gt;
		1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def approved_as_sample&lt;br /&gt;
		2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def rejected_as_sample&lt;br /&gt;
		3&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the existing implementation of reviews, when a student starts a review (but hasn’t filled any text or ratings yet), a response gets created in the database. This response has a default visibility of 0.&lt;br /&gt;
&lt;br /&gt;
We have provided a checkbox (an HTML input node with attribute ‘type’ as ‘checkbox’) for the student to consent for his / her review to be used as an example, with values 0 and 1 for unchecked and checked respectively. This value is used to update the response object as part of the form submission.&lt;br /&gt;
&lt;br /&gt;
However, a student might want to remove their consent or give their consent, for a review that is already submitted. So, in the page where student views his / her own response, we have added the same HTML checkbox. On checking or unchecking the checkbox, the visibility field in the corresponding response object in the database gets updated.Consider this as case 1.&lt;br /&gt;
&lt;br /&gt;
Now when a power user looks at a review (at url , which is an HTML rendering of a ResponseMap containing Responses), he/she must be able to approve and reject responses which students have consented (offered) to be made visible to all. This is done by providing a button “Mark as Sample” or “Remove as Sample”. Responses without consent will not have any button.&lt;br /&gt;
&lt;br /&gt;
These HTML changes appear in views/popup/team_users_popup.html.haml&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if instance_variable_get('@sample_button_'+round.to_s)&lt;br /&gt;
        %div{:class=&amp;gt;'col-md-12 mark-delete-sample '+'round'+round.to_s}&lt;br /&gt;
          %h3{:class=&amp;gt;'col-md-10'} &amp;quot;Reviewed by #{User.find(@reviewer_id).fullname} (Round #{round})&amp;quot;&lt;br /&gt;
          %div{:class=&amp;gt;'col-md-2'}&lt;br /&gt;
&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@mark_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':2, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Mark as Sample&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@remove_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':3, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Remove as Sample&lt;br /&gt;
&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_fail_&amp;quot;+round.to_s}&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result success&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_success_&amp;quot;+round.to_s}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on “Mark as Sample” or “Unmark as Sample” changes the visibility of the response to 2 or 3 respectively. Like case 1 mentioned above, this is another situation where the visibility needs to be updated when there is a page event.&lt;br /&gt;
&lt;br /&gt;
Both these cases are event-based and require to make an HTTP request from the browser and handle the response while staying on the same page. Therefore, according to standard practice, an AJAX request must be initiated on click of the button or checkbox. The request needs two parameters - response id, and the updated value of visibility. User-identifying data is sent by default in HTTP header cookies (as in any usual HTTP request).&lt;br /&gt;
&lt;br /&gt;
To handle these requests, we have created a sample_reviews controller with a method update_visibility. Within the method, we first check whether the request parameters are valid, and then proceed to check whether the current user (identified by session id) should be allowed to edit the response object to the visibility value passed in the request.&lt;br /&gt;
&lt;br /&gt;
We have validated requests in this manner since HTTP is stateless and requests can easily be cloned (a browser need not be the only client making requests). For example, one could simply copy the request as a cURL, change the session id in the HTTP header to a student’s session, and pass alternative values of visibility (say 2, meaning, approved as a sample) in the request. Such requests should be identified as unauthorized requests, while requests which want to update visibility to a value that’s not allowed need to be rejected as bad requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def update_visibility&lt;br /&gt;
	begin&lt;br /&gt;
	visibility = params[:visibility] #response object consists of visibility in string format&lt;br /&gt;
	if(visibility.nil?)&lt;br /&gt;
	raise StandardError.new(&amp;quot;Missing parameter 'visibility'&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
	visibility = visibility.to_i&lt;br /&gt;
&lt;br /&gt;
	if not (_private..rejected_as_sample).include? visibility&lt;br /&gt;
		raise StandardError.new(&amp;quot;Invalid value for parameter 'visibility'&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	@@response_id = params[:id]&lt;br /&gt;
	response_map_id = Response.find(@@response_id).map_id&lt;br /&gt;
	response_map = ResponseMap.find(response_map_id)&lt;br /&gt;
	assignment_id = response_map.reviewed_object_id&lt;br /&gt;
	is_admin = [Role.administrator.id,Role.superadministrator.id].include? current_user.role.id&lt;br /&gt;
	if is_admin&lt;br /&gt;
		Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
		update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	course_id = Assignment.find(assignment_id).course_id&lt;br /&gt;
	instructor_id = Course.find(course_id).instructor_id&lt;br /&gt;
	ta_ids = []&lt;br /&gt;
	if current_user.role.id == Role.ta.id&lt;br /&gt;
	        ta_ids = TaMapping.where(course_id).ids # do this query only if current user is ta&lt;br /&gt;
	elsif current_user.role.id == Role.student.id&lt;br /&gt;
		# find if this student id is the same as the response reviewer id&lt;br /&gt;
		# and that visiblity is 0 or 1 and nothing else.&lt;br /&gt;
		# if anything fails, return failure&lt;br /&gt;
		if visibility &amp;gt; in_review&lt;br /&gt;
		           render json:{&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Not allowed&amp;quot;}&lt;br /&gt;
			        return&lt;br /&gt;
			    end&lt;br /&gt;
		reviewer_user_id = AssignmentParticipant.find(response_map.reviewer_id).user_id&lt;br /&gt;
		if reviewer_user_id != current_user.id&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
			 	return&lt;br /&gt;
		         end&lt;br /&gt;
&lt;br /&gt;
	elsif not ([instructor_id] + ta_ids).include? current_user.id&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
	update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		rescue StandardError =&amp;gt; e&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; e.message}&lt;br /&gt;
		else&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have provided a success or error message text below the button to indicate to the user that the request is completed.&lt;br /&gt;
&lt;br /&gt;
[[file: Mark unmark picssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have used the same request mark_unmark/:id with POST data as {“visibility”:x}, in the student view as well.&lt;br /&gt;
&lt;br /&gt;
This project also required that assignments be linked to each other, as explained in the sections above. To this end, we have created a controller, model, and a migration (to create the database table) for similar assignments.&lt;br /&gt;
&lt;br /&gt;
By default, every assignment is similar to itself (assume it’s id is X). So, after updating a response’s visibility, we add a new entry in the similar_assignments table: (assignment_id = X, similar_for = X, association_intent = “Review”). This addition is done only after confirming for non-existence, as one can infer from the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private&lt;br /&gt;
	def update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		if visibility == approved_as_sample&lt;br /&gt;
			ids = SimilarAssignment.where(:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			if ids.empty?&lt;br /&gt;
				SimilarAssignment.create({:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if visibility == rejected_as_sample or visibility == _private&lt;br /&gt;
			response_map_ids = ResponseMap.where(:reviewed_object_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			response_ids = Response.where(:map_id =&amp;gt; response_map_ids, :visibility =&amp;gt; approved_as_sample)&lt;br /&gt;
			if response_ids.empty?&lt;br /&gt;
				SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).destroy_all&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The power user visits a review response page expecting to mark some reviews as samples and then link or unlink the assignment associated with the review to his / her other assignments. To provide the linking functionality, we have provided a clickable text  “ Use as Samples for More Assignments” at the top right corner of the page as shown below.&lt;br /&gt;
&lt;br /&gt;
[[for use as sample for more assignment]]&lt;br /&gt;
&lt;br /&gt;
The appearance or non-appearance of this text is conditional. It only appears when there is at least one sample review for the current assignment. So, to decide this, we have queried for those assignments for which this assignment is a similar one, and checked on the size of the query result. The size is then checked in popup_controller to set an instance variable popup_show to a boolean value. The view uses this to render or not render the clickable “Use as Samples for More Assignments” text.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_similar_assignment_ids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def get_similar_assignment_ids(assignment_id)&lt;br /&gt;
      SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).pluck(:is_similar_for)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet of popup_controller line 84&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@page_size = popup_page_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On click of this text, we open a popup that lists out (with a checkbox alongside each list entry) the candidate assignments that this assignment can be similar for (these are unchecked), and assignments that it is already similar for (these are checked). For example, assume that the power user is viewing the response page of assignment X. Assume we have entries (X,Y,”review”) and (X,Z,”review”) in similar_assignments table. Then, the popup list will have the assignments Y and Z with a checkbox against each of them ticked, and all the other assignments that the current user has access to, with a checkbox against each of them unticked.&lt;br /&gt;
&lt;br /&gt;
The popup and the data that go with it are fetched on demand. So, the assignment list need not be a part of the first render of the page itself, as the inherent querying would slow down page load time. Therefore, on click, we fetch the list by an AJAX request (we have given appropriate error messages below the clickable text for the rare eventuality of any server-side error or empty response).&lt;br /&gt;
&lt;br /&gt;
This request GET “/similar_assignments/:id” is again authenticated in similar_assignments_controller, get method. Same validation ideas as explained earlier are used. Only the assignment’s course instructor and TAs, admin, and super-admin should be able to fetch this data, while others need not have access to it.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # GET /similar_assignments/:id&lt;br /&gt;
def get&lt;br /&gt;
    @assignment_id = params[:id]&lt;br /&gt;
    ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
    WHERE visibility=2 AND reviewed_object_id =&amp;quot;+@assignment_id.to_s).ids&lt;br /&gt;
    if ids.empty?&lt;br /&gt;
    render json: {&amp;quot;success&amp;quot;=&amp;gt;false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Please mark atleast one review as sample&amp;quot;}&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    begin&lt;br /&gt;
      if current_user.role.id == Role.student.id&lt;br /&gt;
        throw Exception.new&lt;br /&gt;
      end&lt;br /&gt;
    @similar_assignments = SimilarAssignment.where(:assignment_id =&amp;gt; @assignment_id).&lt;br /&gt;
    where.not(:is_similar_for=&amp;gt;@assignment_id).order(&amp;quot;created_at DESC&amp;quot;).pluck(:is_similar_for)&lt;br /&gt;
    rescue ActiveRecord::RecordNotFound =&amp;gt; e&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Resource not found&amp;quot;}&lt;br /&gt;
    rescue Exception&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unauthorized&amp;quot;}&lt;br /&gt;
    else&lt;br /&gt;
      @res = get_asssignments_set(@similar_assignments)&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;values&amp;quot; =&amp;gt; @res}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The get method fetches similar assignment ids and passes them on to get_asssignments_set of similar_assignments_helper. This method queries for all assignments (except the ones passed in its parameter list) that the current user is allowed to access and returns a list of hash objects which are used by the caller (the on-success function of the AJAX request). Each hash object contains assignment name, id, it’s course name, and whether it’s a similar assignment or not. Following code snippets demonstrates this:&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_asssignments_set method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_asssignments_set(selected)&lt;br /&gt;
    all_assignments = get_assignments_based_on_role&lt;br /&gt;
    assignment_array = []&lt;br /&gt;
    courses = get_courses_based_on_role&lt;br /&gt;
    all_assignments.each {&lt;br /&gt;
        |assignment|&lt;br /&gt;
      course_id = assignment.course_id&lt;br /&gt;
      if(course_id.nil?)&lt;br /&gt;
       next&lt;br /&gt;
      end&lt;br /&gt;
      if (selected.include? assignment.id)&lt;br /&gt;
        hash1 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; true, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash1)&lt;br /&gt;
      else&lt;br /&gt;
        hash2 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; false, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash2)&lt;br /&gt;
      end&lt;br /&gt;
    }&lt;br /&gt;
    return assignment_array&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_assignments_based_on_role method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_assignments_based_on_role()&lt;br /&gt;
    role = current_user.role.id&lt;br /&gt;
    page = params[:page]&lt;br /&gt;
    assignment_id = params[:id].to_i&lt;br /&gt;
    if page.nil?&lt;br /&gt;
      page = 0&lt;br /&gt;
    end&lt;br /&gt;
    _offset = page.to_i * popup_page_size&lt;br /&gt;
    case role&lt;br /&gt;
      when Role.ta.id&lt;br /&gt;
        course_ids = TaMapping.where(:ta_id =&amp;gt; current_user.id).pluck(:course_id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
          where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      when Role.instructor.id&lt;br /&gt;
        course_ids = Course.where(:instructor_id =&amp;gt; current_user.id).pluck(:id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
           where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        @all_assignments = []&lt;br /&gt;
    end&lt;br /&gt;
    @all_assignments&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The query result can be prohibitively large. This calls for pagination.&lt;br /&gt;
&lt;br /&gt;
Pagination at the server side is about performing the same query as a non-pagination implementation, with an addition: limit and offset. Limit denotes the size of a page, and offset denotes a start index, and is calculated as page size * page number. Page size is a constant defined in similar_assignments_constants.&lt;br /&gt;
&lt;br /&gt;
We had two options for response and rendering:&lt;br /&gt;
Construct the popup list HTML from the query results and respond with this HTML.&lt;br /&gt;
Respond with JSON, and build the HTML client side.&lt;br /&gt;
&lt;br /&gt;
Responding with HTML from server-side is expensive, as the byte size of the HTTP response would be significantly larger than JSON. Thus, we chose the second option.&lt;br /&gt;
&lt;br /&gt;
Since HTTP is stateless, the server has no way to maintain a running counter of page number. Therefore, keeping track of page number must be the responsibility of the client (browser JavaScript) who must pass it as a request parameter while the server simply reads it and assumes its lack of existence as page number 0. The following snippet demonstrates this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of response.js line 103-130&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fetchAssignments:function(){&lt;br /&gt;
    var self = this;&lt;br /&gt;
    var ajaxUrl = &amp;quot;/similar_assignments/&amp;quot;+assignmentId;&lt;br /&gt;
    if(this.currentPageNumber &amp;gt; 0){&lt;br /&gt;
        ajaxUrl += &amp;quot;?page=&amp;quot;+this.currentPageNumber;&lt;br /&gt;
    }&lt;br /&gt;
    jQuery.ajax({&lt;br /&gt;
        &amp;quot;url&amp;quot;:ajaxUrl,&lt;br /&gt;
        &amp;quot;type&amp;quot;:&amp;quot;GET&amp;quot;,&lt;br /&gt;
        &amp;quot;dataType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;responseType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;beforeSend&amp;quot;:function(){&lt;br /&gt;
            self.hideSuccess();&lt;br /&gt;
            self.hideError();&lt;br /&gt;
                    },&lt;br /&gt;
        &amp;quot;success&amp;quot;:function(result){&lt;br /&gt;
            if(result.success &amp;amp;&amp;amp; result.values.length){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }else if(result.success &amp;amp;&amp;amp; self.currentPageNumber == 0){&lt;br /&gt;
                self.onFetchFail(&amp;quot;Cannot link this to any assignment!&amp;quot;);&lt;br /&gt;
            }else if(result.success){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }&lt;br /&gt;
            else{&lt;br /&gt;
            self.onFetchFail(result.error);&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;failure&amp;quot;: self.onFetchFail,&lt;br /&gt;
        &amp;quot;error&amp;quot;:self.onFetchFail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have avoided maintaining the constant value of page size once on server side (in similar_assignments_constants) and once on the client side (JS variable). The initial render of the page creates a hidden HTML element that contains the page size, and once the document is ready, response.js selects that element, reads its value into a variable, and deletes that HTML element. This prevents having a page size in the HTML page-source, and more importantly, complies with the DRY principle. Page size should be changed in one function only - and that is in similar_assignments_constants as explained earlier.&lt;br /&gt;
&lt;br /&gt;
From the response JSON containing an array of objects (that are going to be rendered as list items), we have constructed the HTML list. Each list item maintains its assignment id in its HTML data attribute. The following snippet shows this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response.js lines 67-78&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addToList:function(assignment){&lt;br /&gt;
        var assignmentId = assignment.id;&lt;br /&gt;
        var title = assignment.title;&lt;br /&gt;
        var course = assignment.course_name;&lt;br /&gt;
        var displayText = &amp;quot;&amp;lt;strong&amp;gt;&amp;quot;+course+&amp;quot;: &amp;lt;/strong&amp;gt;&amp;quot; +title;&lt;br /&gt;
        var checked = assignment.checked;&lt;br /&gt;
        var newRow = this.template.clone();&lt;br /&gt;
        newRow.removeClass(&amp;quot;hide&amp;quot;).find(&amp;quot;input&amp;quot;).attr(&amp;quot;data-id&amp;quot;,assignmentId).attr(&amp;quot;checked&amp;quot;,checked);&lt;br /&gt;
        newRow.find(&amp;quot;span&amp;quot;).html(displayText).on(&amp;quot;click&amp;quot;,function(){&lt;br /&gt;
            newRow.find(&amp;quot;input&amp;quot;).click();&lt;br /&gt;
        });&lt;br /&gt;
        this.list.append(newRow.removeAttr(&amp;quot;id&amp;quot;));&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
_________________________________________A snapshot of the popup is shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The “More” button (shown in the snapshot above) is used to fetch the next set of results.&lt;br /&gt;
&lt;br /&gt;
After a finite number of requests, the client receives a lesser number of results than expected. This is when pagination must stop (since there are no more results). This is achieved by the object AssignmentsPopup (in our response.js file) - it maintains the page size and current page number. The more button is now replaced by a text “No more results” and it’s on-click functionality is turned off.&lt;br /&gt;
&lt;br /&gt;
______________________________________________Screenshot of popup with “No more results”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further, we have implemented this as a plug-and-play service. By reusing the same popup HTML and the AssignmentsPopup variable, the entire popup can be made a part of any Expertiza page.&lt;br /&gt;
&lt;br /&gt;
The page makes no requests on closing the popup, or on clicking Submit without checking any unchecked list item or unchecking any checked list item. It submits only if there is an overall difference in what items are checked and what are not.&lt;br /&gt;
&lt;br /&gt;
Click of “Submit” makes another AJAX POST request to “/similar_assignments/create/:id” with two params in the post JSON data:&lt;br /&gt;
“checked” - an array of assignment ids that were checked in the list but unchecked while opening the popup&lt;br /&gt;
“unchecked” - an array of assignment ids that were unchecked in the list but checked while opening the popup&lt;br /&gt;
&lt;br /&gt;
Either of these params may be empty, depending on the user’s actions, but not both (if both were empty, we simply close the popup without submitting). However, this optimization is only client side. Server side logic must still check for duplicates - that is, an assignment id under “checked” is already a part of similar_assignments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let current assignment id be X. For each of the checked assignment ids Ci in {C1,C2,...,Cn}, we have checked if there are entries (X,Ci) in similar_assignments table, and if not, then created that entry. Similarly, for each of the unchecked assignment ids Ui in {U1,U2,...,Um}, we have deleted the entry (X,Ui) from similar_assignments.&lt;br /&gt;
&lt;br /&gt;
On a successful update, the client closes the popup and prints a success message.&lt;br /&gt;
&lt;br /&gt;
_________________________________________________________________________________________Snapshot with success message&lt;br /&gt;
&lt;br /&gt;
So far, power users have marked reviews as samples and linked assignments. Now, students need to view these samples. A student would view these sample reviews before writing their review on somebody else’s work. Therefore, we have added a link “View Sample Reviews” to view the list of sample reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here.&amp;lt;pending&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, power users might also want to view samples. We have provided the same link on the following page too.&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here&lt;br /&gt;
&lt;br /&gt;
This page is rendered by the index method in sample_reviews_controller. It is a list of links to sample reviews. The layout of this page is common for users, as long as they are logged in. Non-logged-in or anonymous visitors are redirected to the Expertiza home page. ‘index’ calls a method redirect_anonymous_user in sample_reviews_helper to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of sample_reviews_helper&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def redirect_anonymous_user&lt;br /&gt;
    current_user = session[:user]&lt;br /&gt;
    if current_user.nil?&lt;br /&gt;
        redirect_to &amp;quot;/&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The list of available samples has no upper bound on its size. Yet again, pagination solves this problem. But unlike the case of the popup discussed earlier, the response type differs. A request without a ‘page’ parameter in its URL is a request for the web-page and should, therefore, render HTML, while the same request URL with the ‘page’ parameter is a request for more content, and should, therefore, render JSON. The following snippet from the index method demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample_reviews_controller - index method - add the if-else just before return statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def index&lt;br /&gt;
    redirect_anonymous_user&lt;br /&gt;
    @assignment_id = params[:id].to_i&lt;br /&gt;
    page_number = params[:page].to_i&lt;br /&gt;
    if page_number.nil?&lt;br /&gt;
        page_number = 0&lt;br /&gt;
    end&lt;br /&gt;
    @page_size = 8&lt;br /&gt;
    similar_assignment_ids = get_similar_assignment_ids(@assignment_id)&lt;br /&gt;
    @response_ids = []&lt;br /&gt;
    similar_assignment_ids.each do |id|&lt;br /&gt;
        _offset = page_number * @page_size&lt;br /&gt;
        ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
        WHERE visibility=2 AND reviewed_object_id = &amp;quot;+id.to_s+&lt;br /&gt;
        &amp;quot; ORDER BY responses.created_at LIMIT &amp;quot;+@page_size.to_s+&amp;quot; OFFSET &amp;quot;+_offset.to_s ).ids&lt;br /&gt;
        @response_ids += ids&lt;br /&gt;
    end&lt;br /&gt;
    @links = generate_links(@response_ids)&lt;br /&gt;
    if page_number == 0&lt;br /&gt;
        @course_assignment_name = get_course_assignment_name(@assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
        render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;sampleReviews&amp;quot; =&amp;gt; @links}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During this first render itself, we have also identified whether more results can exist. The “More” button only appears if the number of sample review links being rendered is equal to the page size, as shown in a snippet of views/sample_reviews/index.html.erb below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snip of Lines 12-15&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @links.size == @page_size %&amp;gt;&lt;br /&gt;
    &amp;lt;h5 style=&amp;quot;cursor:pointer;text-align: center;&amp;quot; id=&amp;quot;more_button&amp;quot;&amp;gt;More +&amp;lt;/h5&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clicking the “More” button now makes the same request as the page’s URL, but with the parameter ‘page’. In that case, the response is JSON, which is used by the caller (JavaScript Ajax) to add more rows to the page. If the number of rows is lesser than expected, the More text is changed, its click listener is turned off, and no more requests are made, demonstrated by the snippet of sample_review.js below.&lt;br /&gt;
&lt;br /&gt;
Code snip of Line 25-35&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i in result.sampleReviews)&lt;br /&gt;
{&lt;br /&gt;
    currentNumberOfRows++;&lt;br /&gt;
    var review = result.sampleReviews[i];&lt;br /&gt;
    var newRow = listTemplate.clone();&lt;br /&gt;
    newRow.removeClass(&amp;quot;hide&amp;quot;).removeAttr(&amp;quot;id&amp;quot;).find(&amp;quot;a&amp;quot;).&lt;br /&gt;
    html(&amp;quot;Sample Review &amp;quot;+currentNumberOfRows).attr(&amp;quot;href&amp;quot;,review);&lt;br /&gt;
    ulList.append(newRow);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if(responseSize &amp;lt; pageSize){&lt;br /&gt;
self.html(&amp;quot;No more results!&amp;quot;).off().css({&amp;quot;cursor&amp;quot;:&amp;quot;default&amp;quot;});&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
pageNumber++;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each of the list items on the page is a link, which takes the user to /sample_reviews/:id. On this page, we fetch the question-answer pairs corresponding to the object having the id given in the URL and print it out in the form of a table.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User (TA/Instructor/Admin/Super Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student, with a &amp;quot;Make as sample&amp;quot; button on the right of every review.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment task page is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to open the reviews summary page (at /student_review).&lt;br /&gt;
# Below the heading &amp;quot;Reviews for ...&amp;quot;, click on the &amp;quot;Show sample reviews&amp;quot; link.&lt;br /&gt;
# This opens a page where the student can view all sample reviews for that assignment.&lt;br /&gt;
# Use the browser's back button to go back to Assignment review page.&lt;br /&gt;
# Chose to review any of the teams' assignments that are displayed.&lt;br /&gt;
# Select a team for review and fill in the review.&lt;br /&gt;
# Before submitting the review, select the checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted has been made public.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RSpec Tests'''&lt;br /&gt;
Below are the Rpsec tests that have been added to test the edge cases when a user tries to get access to the data using cloned requests:&lt;br /&gt;
# If an anonymous user tries to view the sample reviews page he/she will be redirected to home page.&lt;br /&gt;
# If an anonymous user tries to view the details of a particular sample review, he/she will be redirected to home page.&lt;br /&gt;
# If a user tries to view the sample review of a particular assignment for which there are no sample reviews, he/she will be redirected to home page.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121230</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121230"/>
		<updated>2018-12-07T23:25:41Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach &amp;amp; Design ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for &amp;quot;similar_assignments&amp;quot; and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DB Design'''&lt;br /&gt;
&lt;br /&gt;
Currently, the Expertiza database design does not maintain any link between different assignments. An assignment of the current semester is completely independent of any other assignment of any other course having similar or exact objectives. For example, in a course C, the assignment named A1 in a semester Sx has no association to the same assignment given in an earlier semester Sy.&lt;br /&gt;
&lt;br /&gt;
Since our task involves using reviews from the past as samples for the present, we should create this association as a new table. Further, reviews may not be the only intention to associate assignments with each other, as future requirements might require associating them on other criteria too. Thus, we find it appropriate to name the table as &amp;quot;similar_assignments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The table structure is defined [http://wiki.expertiza.ncsu.edu/index.php/Similar_assignments here].&lt;br /&gt;
&lt;br /&gt;
This table can be visualized as a directed graph where vertices represent assignments. An edge (u,v) with a label L means u is similar to v for the intent of association, L.&lt;br /&gt;
&lt;br /&gt;
Consider a row (id = x, assignment_id = Ak, is_similar_for = An, association_intent = &amp;quot;review&amp;quot;). This means, given the intent of association as &amp;quot;review&amp;quot;, assignment Ak was chosen as a similar assignment for assignment An. That is, while marking some review for An as a sample, the instructor opted to have reviews of Ak as samples for An as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:UseCase.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Power Users:''' Instructors, TAs, Admins and Super Admins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''More details about each point mentioned in the approach section will be updated after the implementation.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
We have added a new column in the ‘responses’ table (in the database), namely, ‘visibility’. &lt;br /&gt;
Visibility can have 4 values as listed below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table showing list of visibility values and the properties&lt;br /&gt;
! Visibility &lt;br /&gt;
! Properties &lt;br /&gt;
|-&lt;br /&gt;
| 0 || Response is private. This is the default value.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 2 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || The response which was either in the review or approved earlier, has now been rejected as an example (it has been unmarked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We have maintained these constants in a new file at helpers/response_constants.rb.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ResponseConstants&lt;br /&gt;
	def _private&lt;br /&gt;
		0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def in_review&lt;br /&gt;
		1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def approved_as_sample&lt;br /&gt;
		2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def rejected_as_sample&lt;br /&gt;
		3&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the existing implementation of reviews, when a student starts a review (but hasn’t filled any text or ratings yet), a response gets created in the database. This response has a default visibility of 0.&lt;br /&gt;
&lt;br /&gt;
We have provided a checkbox (an HTML input node with attribute ‘type’ as ‘checkbox’) for the student to consent for his / her review to be used as an example, with values 0 and 1 for unchecked and checked respectively. This value is used to update the response object as part of the form submission.&lt;br /&gt;
&lt;br /&gt;
However, a student might want to remove their consent or give their consent, for a review that is already submitted. So, in the page where student views his / her own response, we have added the same HTML checkbox. On checking or unchecking the checkbox, the visibility field in the corresponding response object in the database gets updated.Consider this as case 1.&lt;br /&gt;
&lt;br /&gt;
Now when a power user looks at a review (at url , which is an HTML rendering of a ResponseMap containing Responses), he/she must be able to approve and reject responses which students have consented (offered) to be made visible to all. This is done by providing a button “Mark as Sample” or “Remove as Sample”. Responses without consent will not have any button.&lt;br /&gt;
&lt;br /&gt;
These HTML changes appear in views/popup/team_users_popup.html.haml&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if instance_variable_get('@sample_button_'+round.to_s)&lt;br /&gt;
        %div{:class=&amp;gt;'col-md-12 mark-delete-sample '+'round'+round.to_s}&lt;br /&gt;
          %h3{:class=&amp;gt;'col-md-10'} &amp;quot;Reviewed by #{User.find(@reviewer_id).fullname} (Round #{round})&amp;quot;&lt;br /&gt;
          %div{:class=&amp;gt;'col-md-2'}&lt;br /&gt;
&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@mark_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':2, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Mark as Sample&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@remove_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':3, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Remove as Sample&lt;br /&gt;
&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_fail_&amp;quot;+round.to_s}&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result success&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_success_&amp;quot;+round.to_s}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on “Mark as Sample” or “Unmark as Sample” changes the visibility of the response to 2 or 3 respectively. Like case 1 mentioned above, this is another situation where the visibility needs to be updated when there is a page event.&lt;br /&gt;
&lt;br /&gt;
Both these cases are event-based and require to make an HTTP request from the browser and handle the response while staying on the same page. Therefore, according to standard practice, an AJAX request must be initiated on click of the button or checkbox. The request needs two parameters - response id, and the updated value of visibility. User-identifying data is sent by default in HTTP header cookies (as in any usual HTTP request).&lt;br /&gt;
&lt;br /&gt;
To handle these requests, we have created a sample_reviews controller with a method update_visibility. Within the method, we first check whether the request parameters are valid, and then proceed to check whether the current user (identified by session id) should be allowed to edit the response object to the visibility value passed in the request.&lt;br /&gt;
&lt;br /&gt;
We have validated requests in this manner since HTTP is stateless and requests can easily be cloned (a browser need not be the only client making requests). For example, one could simply copy the request as a cURL, change the session id in the HTTP header to a student’s session, and pass alternative values of visibility (say 2, meaning, approved as a sample) in the request. Such requests should be identified as unauthorized requests, while requests which want to update visibility to a value that’s not allowed need to be rejected as bad requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def update_visibility&lt;br /&gt;
	begin&lt;br /&gt;
	visibility = params[:visibility] #response object consists of visibility in string format&lt;br /&gt;
	if(visibility.nil?)&lt;br /&gt;
	raise StandardError.new(&amp;quot;Missing parameter 'visibility'&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
	visibility = visibility.to_i&lt;br /&gt;
&lt;br /&gt;
	if not (_private..rejected_as_sample).include? visibility&lt;br /&gt;
		raise StandardError.new(&amp;quot;Invalid value for parameter 'visibility'&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	@@response_id = params[:id]&lt;br /&gt;
	response_map_id = Response.find(@@response_id).map_id&lt;br /&gt;
	response_map = ResponseMap.find(response_map_id)&lt;br /&gt;
	assignment_id = response_map.reviewed_object_id&lt;br /&gt;
	is_admin = [Role.administrator.id,Role.superadministrator.id].include? current_user.role.id&lt;br /&gt;
	if is_admin&lt;br /&gt;
		Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
		update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	course_id = Assignment.find(assignment_id).course_id&lt;br /&gt;
	instructor_id = Course.find(course_id).instructor_id&lt;br /&gt;
	ta_ids = []&lt;br /&gt;
	if current_user.role.id == Role.ta.id&lt;br /&gt;
	        ta_ids = TaMapping.where(course_id).ids # do this query only if current user is ta&lt;br /&gt;
	elsif current_user.role.id == Role.student.id&lt;br /&gt;
		# find if this student id is the same as the response reviewer id&lt;br /&gt;
		# and that visiblity is 0 or 1 and nothing else.&lt;br /&gt;
		# if anything fails, return failure&lt;br /&gt;
		if visibility &amp;gt; in_review&lt;br /&gt;
		           render json:{&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Not allowed&amp;quot;}&lt;br /&gt;
			        return&lt;br /&gt;
			    end&lt;br /&gt;
		reviewer_user_id = AssignmentParticipant.find(response_map.reviewer_id).user_id&lt;br /&gt;
		if reviewer_user_id != current_user.id&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
			 	return&lt;br /&gt;
		         end&lt;br /&gt;
&lt;br /&gt;
	elsif not ([instructor_id] + ta_ids).include? current_user.id&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
	update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		rescue StandardError =&amp;gt; e&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; e.message}&lt;br /&gt;
		else&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have provided a success or error message text below the button to indicate to the user that the request is completed.&lt;br /&gt;
&lt;br /&gt;
[[file: Mark unmark picssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have used the same request mark_unmark/:id with POST data as {“visibility”:x}, in the student view as well.&lt;br /&gt;
&lt;br /&gt;
This project also required that assignments be linked to each other, as explained in the sections above. To this end, we have created a controller, model, and a migration (to create the database table) for similar assignments.&lt;br /&gt;
&lt;br /&gt;
By default, every assignment is similar to itself (assume it’s id is X). So, after updating a response’s visibility, we add a new entry in the similar_assignments table: (assignment_id = X, similar_for = X, association_intent = “Review”). This addition is done only after confirming for non-existence, as one can infer from the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private&lt;br /&gt;
	def update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		if visibility == approved_as_sample&lt;br /&gt;
			ids = SimilarAssignment.where(:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			if ids.empty?&lt;br /&gt;
				SimilarAssignment.create({:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if visibility == rejected_as_sample or visibility == _private&lt;br /&gt;
			response_map_ids = ResponseMap.where(:reviewed_object_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			response_ids = Response.where(:map_id =&amp;gt; response_map_ids, :visibility =&amp;gt; approved_as_sample)&lt;br /&gt;
			if response_ids.empty?&lt;br /&gt;
				SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).destroy_all&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The power user visits a review response page expecting to mark some reviews as samples and then link or unlink the assignment associated with the review to his / her other assignments. To provide the linking functionality, we have provided a clickable text  “ Use as Samples for More Assignments” at the top right corner of the page as shown below.&lt;br /&gt;
&lt;br /&gt;
[[for use as sample for more assignment]]&lt;br /&gt;
&lt;br /&gt;
The appearance or non-appearance of this text is conditional. It only appears when there is at least one sample review for the current assignment. So, to decide this, we have queried for those assignments for which this assignment is a similar one, and checked on the size of the query result. The size is then checked in popup_controller to set an instance variable popup_show to a boolean value. The view uses this to render or not render the clickable “Use as Samples for More Assignments” text.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_similar_assignment_ids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def get_similar_assignment_ids(assignment_id)&lt;br /&gt;
      SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).pluck(:is_similar_for)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet of popup_controller line 84&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@page_size = popup_page_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On click of this text, we open a popup that lists out (with a checkbox alongside each list entry) the candidate assignments that this assignment can be similar for (these are unchecked), and assignments that it is already similar for (these are checked). For example, assume that the power user is viewing the response page of assignment X. Assume we have entries (X,Y,”review”) and (X,Z,”review”) in similar_assignments table. Then, the popup list will have the assignments Y and Z with a checkbox against each of them ticked, and all the other assignments that the current user has access to, with a checkbox against each of them unticked.&lt;br /&gt;
&lt;br /&gt;
The popup and the data that go with it are fetched on demand. So, the assignment list need not be a part of the first render of the page itself, as the inherent querying would slow down page load time. Therefore, on click, we fetch the list by an AJAX request (we have given appropriate error messages below the clickable text for the rare eventuality of any server-side error or empty response).&lt;br /&gt;
&lt;br /&gt;
This request GET “/similar_assignments/:id” is again authenticated in similar_assignments_controller, get method. Same validation ideas as explained earlier are used. Only the assignment’s course instructor and TAs, admin, and super-admin should be able to fetch this data, while others need not have access to it.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # GET /similar_assignments/:id&lt;br /&gt;
def get&lt;br /&gt;
    @assignment_id = params[:id]&lt;br /&gt;
    ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
    WHERE visibility=2 AND reviewed_object_id =&amp;quot;+@assignment_id.to_s).ids&lt;br /&gt;
    if ids.empty?&lt;br /&gt;
    render json: {&amp;quot;success&amp;quot;=&amp;gt;false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Please mark atleast one review as sample&amp;quot;}&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    begin&lt;br /&gt;
      if current_user.role.id == Role.student.id&lt;br /&gt;
        throw Exception.new&lt;br /&gt;
      end&lt;br /&gt;
    @similar_assignments = SimilarAssignment.where(:assignment_id =&amp;gt; @assignment_id).&lt;br /&gt;
    where.not(:is_similar_for=&amp;gt;@assignment_id).order(&amp;quot;created_at DESC&amp;quot;).pluck(:is_similar_for)&lt;br /&gt;
    rescue ActiveRecord::RecordNotFound =&amp;gt; e&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Resource not found&amp;quot;}&lt;br /&gt;
    rescue Exception&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unauthorized&amp;quot;}&lt;br /&gt;
    else&lt;br /&gt;
      @res = get_asssignments_set(@similar_assignments)&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;values&amp;quot; =&amp;gt; @res}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The get method fetches similar assignment ids and passes them on to get_asssignments_set of similar_assignments_helper. This method queries for all assignments (except the ones passed in its parameter list) that the current user is allowed to access and returns a list of hash objects which are used by the caller (the on-success function of the AJAX request). Each hash object contains assignment name, id, it’s course name, and whether it’s a similar assignment or not. Following code snippets demonstrates this:&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_asssignments_set method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_asssignments_set(selected)&lt;br /&gt;
    all_assignments = get_assignments_based_on_role&lt;br /&gt;
    assignment_array = []&lt;br /&gt;
    courses = get_courses_based_on_role&lt;br /&gt;
    all_assignments.each {&lt;br /&gt;
        |assignment|&lt;br /&gt;
      course_id = assignment.course_id&lt;br /&gt;
      if(course_id.nil?)&lt;br /&gt;
       next&lt;br /&gt;
      end&lt;br /&gt;
      if (selected.include? assignment.id)&lt;br /&gt;
        hash1 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; true, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash1)&lt;br /&gt;
      else&lt;br /&gt;
        hash2 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; false, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash2)&lt;br /&gt;
      end&lt;br /&gt;
    }&lt;br /&gt;
    return assignment_array&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_assignments_based_on_role method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_assignments_based_on_role()&lt;br /&gt;
    role = current_user.role.id&lt;br /&gt;
    page = params[:page]&lt;br /&gt;
    assignment_id = params[:id].to_i&lt;br /&gt;
    if page.nil?&lt;br /&gt;
      page = 0&lt;br /&gt;
    end&lt;br /&gt;
    _offset = page.to_i * popup_page_size&lt;br /&gt;
    case role&lt;br /&gt;
      when Role.ta.id&lt;br /&gt;
        course_ids = TaMapping.where(:ta_id =&amp;gt; current_user.id).pluck(:course_id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
          where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      when Role.instructor.id&lt;br /&gt;
        course_ids = Course.where(:instructor_id =&amp;gt; current_user.id).pluck(:id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
           where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        @all_assignments = []&lt;br /&gt;
    end&lt;br /&gt;
    @all_assignments&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The query result can be prohibitively large. This calls for pagination.&lt;br /&gt;
&lt;br /&gt;
Pagination at the server side is about performing the same query as a non-pagination implementation, with an addition: limit and offset. Limit denotes the size of a page, and offset denotes a start index, and is calculated as page size * page number. Page size is a constant defined in similar_assignments_constants.&lt;br /&gt;
&lt;br /&gt;
We had two options for response and rendering:&lt;br /&gt;
Construct the popup list HTML from the query results and respond with this HTML.&lt;br /&gt;
Respond with JSON, and build the HTML client side.&lt;br /&gt;
&lt;br /&gt;
Responding with HTML from server-side is expensive, as the byte size of the HTTP response would be significantly larger than JSON. Thus, we chose the second option.&lt;br /&gt;
&lt;br /&gt;
Since HTTP is stateless, the server has no way to maintain a running counter of page number. Therefore, keeping track of page number must be the responsibility of the client (browser JavaScript) who must pass it as a request parameter while the server simply reads it and assumes its lack of existence as page number 0. The following snippet demonstrates this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of response.js line 103-130&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fetchAssignments:function(){&lt;br /&gt;
    var self = this;&lt;br /&gt;
    var ajaxUrl = &amp;quot;/similar_assignments/&amp;quot;+assignmentId;&lt;br /&gt;
    if(this.currentPageNumber &amp;gt; 0){&lt;br /&gt;
        ajaxUrl += &amp;quot;?page=&amp;quot;+this.currentPageNumber;&lt;br /&gt;
    }&lt;br /&gt;
    jQuery.ajax({&lt;br /&gt;
        &amp;quot;url&amp;quot;:ajaxUrl,&lt;br /&gt;
        &amp;quot;type&amp;quot;:&amp;quot;GET&amp;quot;,&lt;br /&gt;
        &amp;quot;dataType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;responseType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;beforeSend&amp;quot;:function(){&lt;br /&gt;
            self.hideSuccess();&lt;br /&gt;
            self.hideError();&lt;br /&gt;
                    },&lt;br /&gt;
        &amp;quot;success&amp;quot;:function(result){&lt;br /&gt;
            if(result.success &amp;amp;&amp;amp; result.values.length){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }else if(result.success &amp;amp;&amp;amp; self.currentPageNumber == 0){&lt;br /&gt;
                self.onFetchFail(&amp;quot;Cannot link this to any assignment!&amp;quot;);&lt;br /&gt;
            }else if(result.success){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }&lt;br /&gt;
            else{&lt;br /&gt;
            self.onFetchFail(result.error);&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;failure&amp;quot;: self.onFetchFail,&lt;br /&gt;
        &amp;quot;error&amp;quot;:self.onFetchFail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have avoided maintaining the constant value of page size once on server side (in similar_assignments_constants) and once on the client side (JS variable). The initial render of the page creates a hidden HTML element that contains the page size, and once the document is ready, response.js selects that element, reads its value into a variable, and deletes that HTML element. This prevents having a page size in the HTML page-source, and more importantly, complies with the DRY principle. Page size should be changed in one function only - and that is in similar_assignments_constants as explained earlier.&lt;br /&gt;
&lt;br /&gt;
From the response JSON containing an array of objects (that are going to be rendered as list items), we have constructed the HTML list. Each list item maintains its assignment id in its HTML data attribute. The following snippet shows this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response.js lines 67-78&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addToList:function(assignment){&lt;br /&gt;
        var assignmentId = assignment.id;&lt;br /&gt;
        var title = assignment.title;&lt;br /&gt;
        var course = assignment.course_name;&lt;br /&gt;
        var displayText = &amp;quot;&amp;lt;strong&amp;gt;&amp;quot;+course+&amp;quot;: &amp;lt;/strong&amp;gt;&amp;quot; +title;&lt;br /&gt;
        var checked = assignment.checked;&lt;br /&gt;
        var newRow = this.template.clone();&lt;br /&gt;
        newRow.removeClass(&amp;quot;hide&amp;quot;).find(&amp;quot;input&amp;quot;).attr(&amp;quot;data-id&amp;quot;,assignmentId).attr(&amp;quot;checked&amp;quot;,checked);&lt;br /&gt;
        newRow.find(&amp;quot;span&amp;quot;).html(displayText).on(&amp;quot;click&amp;quot;,function(){&lt;br /&gt;
            newRow.find(&amp;quot;input&amp;quot;).click();&lt;br /&gt;
        });&lt;br /&gt;
        this.list.append(newRow.removeAttr(&amp;quot;id&amp;quot;));&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
_________________________________________A snapshot of the popup is shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The “More” button (shown in the snapshot above) is used to fetch the next set of results.&lt;br /&gt;
&lt;br /&gt;
After a finite number of requests, the client receives a lesser number of results than expected. This is when pagination must stop (since there are no more results). This is achieved by the object AssignmentsPopup (in our response.js file) - it maintains the page size and current page number. The more button is now replaced by a text “No more results” and it’s on-click functionality is turned off.&lt;br /&gt;
&lt;br /&gt;
______________________________________________Screenshot of popup with “No more results”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further, we have implemented this as a plug-and-play service. By reusing the same popup HTML and the AssignmentsPopup variable, the entire popup can be made a part of any Expertiza page.&lt;br /&gt;
&lt;br /&gt;
The page makes no requests on closing the popup, or on clicking Submit without checking any unchecked list item or unchecking any checked list item. It submits only if there is an overall difference in what items are checked and what are not.&lt;br /&gt;
&lt;br /&gt;
Click of “Submit” makes another AJAX POST request to “/similar_assignments/create/:id” with two params in the post JSON data:&lt;br /&gt;
“checked” - an array of assignment ids that were checked in the list but unchecked while opening the popup&lt;br /&gt;
“unchecked” - an array of assignment ids that were unchecked in the list but checked while opening the popup&lt;br /&gt;
&lt;br /&gt;
Either of these params may be empty, depending on the user’s actions, but not both (if both were empty, we simply close the popup without submitting). However, this optimization is only client side. Server side logic must still check for duplicates - that is, an assignment id under “checked” is already a part of similar_assignments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let current assignment id be X. For each of the checked assignment ids Ci in {C1,C2,...,Cn}, we have checked if there are entries (X,Ci) in similar_assignments table, and if not, then created that entry. Similarly, for each of the unchecked assignment ids Ui in {U1,U2,...,Um}, we have deleted the entry (X,Ui) from similar_assignments.&lt;br /&gt;
&lt;br /&gt;
On a successful update, the client closes the popup and prints a success message.&lt;br /&gt;
&lt;br /&gt;
_________________________________________________________________________________________Snapshot with success message&lt;br /&gt;
&lt;br /&gt;
So far, power users have marked reviews as samples and linked assignments. Now, students need to view these samples. A student would view these sample reviews before writing their review on somebody else’s work. Therefore, we have added a link “View Sample Reviews” to view the list of sample reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here.&amp;lt;pending&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, power users might also want to view samples. We have provided the same link on the following page too.&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here&lt;br /&gt;
&lt;br /&gt;
This page is rendered by the index method in sample_reviews_controller. It is a list of links to sample reviews. The layout of this page is common for users, as long as they are logged in. Non-logged-in or anonymous visitors are redirected to the Expertiza home page. ‘index’ calls a method redirect_anonymous_user in sample_reviews_helper to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of sample_reviews_helper&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def redirect_anonymous_user&lt;br /&gt;
    current_user = session[:user]&lt;br /&gt;
    if current_user.nil?&lt;br /&gt;
        redirect_to &amp;quot;/&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The list of available samples has no upper bound on its size. Yet again, pagination solves this problem. But unlike the case of the popup discussed earlier, the response type differs. A request without a ‘page’ parameter in its URL is a request for the web-page and should, therefore, render HTML, while the same request URL with the ‘page’ parameter is a request for more content, and should, therefore, render JSON. The following snippet from the index method demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample_reviews_controller - index method - add the if-else just before return statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def index&lt;br /&gt;
    redirect_anonymous_user&lt;br /&gt;
    @assignment_id = params[:id].to_i&lt;br /&gt;
    page_number = params[:page].to_i&lt;br /&gt;
    if page_number.nil?&lt;br /&gt;
        page_number = 0&lt;br /&gt;
    end&lt;br /&gt;
    @page_size = 8&lt;br /&gt;
    similar_assignment_ids = get_similar_assignment_ids(@assignment_id)&lt;br /&gt;
    @response_ids = []&lt;br /&gt;
    similar_assignment_ids.each do |id|&lt;br /&gt;
        _offset = page_number * @page_size&lt;br /&gt;
        ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
        WHERE visibility=2 AND reviewed_object_id = &amp;quot;+id.to_s+&lt;br /&gt;
        &amp;quot; ORDER BY responses.created_at LIMIT &amp;quot;+@page_size.to_s+&amp;quot; OFFSET &amp;quot;+_offset.to_s ).ids&lt;br /&gt;
        @response_ids += ids&lt;br /&gt;
    end&lt;br /&gt;
    @links = generate_links(@response_ids)&lt;br /&gt;
    if page_number == 0&lt;br /&gt;
        @course_assignment_name = get_course_assignment_name(@assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
        render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;sampleReviews&amp;quot; =&amp;gt; @links}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During this first render itself, we have also identified whether more results can exist. The “More” button only appears if the number of sample review links being rendered is equal to the page size, as shown in a snippet of views/sample_reviews/index.html.erb below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snip of Lines 12-15&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @links.size == @page_size %&amp;gt;&lt;br /&gt;
    &amp;lt;h5 style=&amp;quot;cursor:pointer;text-align: center;&amp;quot; id=&amp;quot;more_button&amp;quot;&amp;gt;More +&amp;lt;/h5&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clicking the “More” button now makes the same request as the page’s URL, but with the parameter ‘page’. In that case, the response is JSON, which is used by the caller (JavaScript Ajax) to add more rows to the page. If the number of rows is lesser than expected, the More text is changed, its click listener is turned off, and no more requests are made, demonstrated by the snippet of sample_review.js below.&lt;br /&gt;
&lt;br /&gt;
Code snip of Line 25-35&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i in result.sampleReviews)&lt;br /&gt;
{&lt;br /&gt;
    currentNumberOfRows++;&lt;br /&gt;
    var review = result.sampleReviews[i];&lt;br /&gt;
    var newRow = listTemplate.clone();&lt;br /&gt;
    newRow.removeClass(&amp;quot;hide&amp;quot;).removeAttr(&amp;quot;id&amp;quot;).find(&amp;quot;a&amp;quot;).&lt;br /&gt;
    html(&amp;quot;Sample Review &amp;quot;+currentNumberOfRows).attr(&amp;quot;href&amp;quot;,review);&lt;br /&gt;
    ulList.append(newRow);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if(responseSize &amp;lt; pageSize){&lt;br /&gt;
self.html(&amp;quot;No more results!&amp;quot;).off().css({&amp;quot;cursor&amp;quot;:&amp;quot;default&amp;quot;});&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
pageNumber++;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each of the list items on the page is a link, which takes the user to /sample_reviews/:id. On this page, we fetch the question-answer pairs corresponding to the object having the id given in the URL and print it out in the form of a table.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User (TA/Instructor/Admin/Super Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student, with a &amp;quot;Make as sample&amp;quot; button on the right of every review.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment task page is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to open the reviews summary page (at /student_review).&lt;br /&gt;
# Below the heading &amp;quot;Reviews for ...&amp;quot;, click on the &amp;quot;Show sample reviews&amp;quot; link.&lt;br /&gt;
# This opens a page where the student can view all sample reviews for that assignment.&lt;br /&gt;
# Use the browser's back button to go back to Assignment review page.&lt;br /&gt;
# Chose to review any of the teams' assignments that are displayed.&lt;br /&gt;
# Select a team for review and fill in the review.&lt;br /&gt;
# Before submitting the review, select the checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted has been made public.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RSpec Tests'''&lt;br /&gt;
'''Below are the Rpsec tests that have been added to test the edge cases when a user tries to get access to the data using cloned requests:'''&lt;br /&gt;
# If an anonymous user tries to view the sample reviews page he/she will be redirected to home page.&lt;br /&gt;
# If an anonymous user tries to view the details of a particular sample review, he/she will be redirected to home page.&lt;br /&gt;
# If a user tries to view the sample review of a particular assignment for which there are no sample reviews, he/she will be redirected to home page.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121229</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121229"/>
		<updated>2018-12-07T23:25:06Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach &amp;amp; Design ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for &amp;quot;similar_assignments&amp;quot; and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DB Design'''&lt;br /&gt;
&lt;br /&gt;
Currently, the Expertiza database design does not maintain any link between different assignments. An assignment of the current semester is completely independent of any other assignment of any other course having similar or exact objectives. For example, in a course C, the assignment named A1 in a semester Sx has no association to the same assignment given in an earlier semester Sy.&lt;br /&gt;
&lt;br /&gt;
Since our task involves using reviews from the past as samples for the present, we should create this association as a new table. Further, reviews may not be the only intention to associate assignments with each other, as future requirements might require associating them on other criteria too. Thus, we find it appropriate to name the table as &amp;quot;similar_assignments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The table structure is defined [http://wiki.expertiza.ncsu.edu/index.php/Similar_assignments here].&lt;br /&gt;
&lt;br /&gt;
This table can be visualized as a directed graph where vertices represent assignments. An edge (u,v) with a label L means u is similar to v for the intent of association, L.&lt;br /&gt;
&lt;br /&gt;
Consider a row (id = x, assignment_id = Ak, is_similar_for = An, association_intent = &amp;quot;review&amp;quot;). This means, given the intent of association as &amp;quot;review&amp;quot;, assignment Ak was chosen as a similar assignment for assignment An. That is, while marking some review for An as a sample, the instructor opted to have reviews of Ak as samples for An as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:UseCase.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Power Users:''' Instructors, TAs, Admins and Super Admins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''More details about each point mentioned in the approach section will be updated after the implementation.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
We have added a new column in the ‘responses’ table (in the database), namely, ‘visibility’. &lt;br /&gt;
Visibility can have 4 values as listed below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table showing list of visibility values and the properties&lt;br /&gt;
! Visibility &lt;br /&gt;
! Properties &lt;br /&gt;
|-&lt;br /&gt;
| 0 || Response is private. This is the default value.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 2 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || The response which was either in the review or approved earlier, has now been rejected as an example (it has been unmarked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We have maintained these constants in a new file at helpers/response_constants.rb.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ResponseConstants&lt;br /&gt;
	def _private&lt;br /&gt;
		0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def in_review&lt;br /&gt;
		1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def approved_as_sample&lt;br /&gt;
		2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def rejected_as_sample&lt;br /&gt;
		3&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the existing implementation of reviews, when a student starts a review (but hasn’t filled any text or ratings yet), a response gets created in the database. This response has a default visibility of 0.&lt;br /&gt;
&lt;br /&gt;
We have provided a checkbox (an HTML input node with attribute ‘type’ as ‘checkbox’) for the student to consent for his / her review to be used as an example, with values 0 and 1 for unchecked and checked respectively. This value is used to update the response object as part of the form submission.&lt;br /&gt;
&lt;br /&gt;
However, a student might want to remove their consent or give their consent, for a review that is already submitted. So, in the page where student views his / her own response, we have added the same HTML checkbox. On checking or unchecking the checkbox, the visibility field in the corresponding response object in the database gets updated.Consider this as case 1.&lt;br /&gt;
&lt;br /&gt;
Now when a power user looks at a review (at url , which is an HTML rendering of a ResponseMap containing Responses), he/she must be able to approve and reject responses which students have consented (offered) to be made visible to all. This is done by providing a button “Mark as Sample” or “Remove as Sample”. Responses without consent will not have any button.&lt;br /&gt;
&lt;br /&gt;
These HTML changes appear in views/popup/team_users_popup.html.haml&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if instance_variable_get('@sample_button_'+round.to_s)&lt;br /&gt;
        %div{:class=&amp;gt;'col-md-12 mark-delete-sample '+'round'+round.to_s}&lt;br /&gt;
          %h3{:class=&amp;gt;'col-md-10'} &amp;quot;Reviewed by #{User.find(@reviewer_id).fullname} (Round #{round})&amp;quot;&lt;br /&gt;
          %div{:class=&amp;gt;'col-md-2'}&lt;br /&gt;
&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@mark_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':2, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Mark as Sample&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@remove_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':3, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Remove as Sample&lt;br /&gt;
&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_fail_&amp;quot;+round.to_s}&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result success&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_success_&amp;quot;+round.to_s}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on “Mark as Sample” or “Unmark as Sample” changes the visibility of the response to 2 or 3 respectively. Like case 1 mentioned above, this is another situation where the visibility needs to be updated when there is a page event.&lt;br /&gt;
&lt;br /&gt;
Both these cases are event-based and require to make an HTTP request from the browser and handle the response while staying on the same page. Therefore, according to standard practice, an AJAX request must be initiated on click of the button or checkbox. The request needs two parameters - response id, and the updated value of visibility. User-identifying data is sent by default in HTTP header cookies (as in any usual HTTP request).&lt;br /&gt;
&lt;br /&gt;
To handle these requests, we have created a sample_reviews controller with a method update_visibility. Within the method, we first check whether the request parameters are valid, and then proceed to check whether the current user (identified by session id) should be allowed to edit the response object to the visibility value passed in the request.&lt;br /&gt;
&lt;br /&gt;
We have validated requests in this manner since HTTP is stateless and requests can easily be cloned (a browser need not be the only client making requests). For example, one could simply copy the request as a cURL, change the session id in the HTTP header to a student’s session, and pass alternative values of visibility (say 2, meaning, approved as a sample) in the request. Such requests should be identified as unauthorized requests, while requests which want to update visibility to a value that’s not allowed need to be rejected as bad requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def update_visibility&lt;br /&gt;
	begin&lt;br /&gt;
	visibility = params[:visibility] #response object consists of visibility in string format&lt;br /&gt;
	if(visibility.nil?)&lt;br /&gt;
	raise StandardError.new(&amp;quot;Missing parameter 'visibility'&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
	visibility = visibility.to_i&lt;br /&gt;
&lt;br /&gt;
	if not (_private..rejected_as_sample).include? visibility&lt;br /&gt;
		raise StandardError.new(&amp;quot;Invalid value for parameter 'visibility'&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	@@response_id = params[:id]&lt;br /&gt;
	response_map_id = Response.find(@@response_id).map_id&lt;br /&gt;
	response_map = ResponseMap.find(response_map_id)&lt;br /&gt;
	assignment_id = response_map.reviewed_object_id&lt;br /&gt;
	is_admin = [Role.administrator.id,Role.superadministrator.id].include? current_user.role.id&lt;br /&gt;
	if is_admin&lt;br /&gt;
		Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
		update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	course_id = Assignment.find(assignment_id).course_id&lt;br /&gt;
	instructor_id = Course.find(course_id).instructor_id&lt;br /&gt;
	ta_ids = []&lt;br /&gt;
	if current_user.role.id == Role.ta.id&lt;br /&gt;
	        ta_ids = TaMapping.where(course_id).ids # do this query only if current user is ta&lt;br /&gt;
	elsif current_user.role.id == Role.student.id&lt;br /&gt;
		# find if this student id is the same as the response reviewer id&lt;br /&gt;
		# and that visiblity is 0 or 1 and nothing else.&lt;br /&gt;
		# if anything fails, return failure&lt;br /&gt;
		if visibility &amp;gt; in_review&lt;br /&gt;
		           render json:{&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Not allowed&amp;quot;}&lt;br /&gt;
			        return&lt;br /&gt;
			    end&lt;br /&gt;
		reviewer_user_id = AssignmentParticipant.find(response_map.reviewer_id).user_id&lt;br /&gt;
		if reviewer_user_id != current_user.id&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
			 	return&lt;br /&gt;
		         end&lt;br /&gt;
&lt;br /&gt;
	elsif not ([instructor_id] + ta_ids).include? current_user.id&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
	update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		rescue StandardError =&amp;gt; e&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; e.message}&lt;br /&gt;
		else&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have provided a success or error message text below the button to indicate to the user that the request is completed.&lt;br /&gt;
&lt;br /&gt;
[[file: Mark unmark picssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have used the same request mark_unmark/:id with POST data as {“visibility”:x}, in the student view as well.&lt;br /&gt;
&lt;br /&gt;
This project also required that assignments be linked to each other, as explained in the sections above. To this end, we have created a controller, model, and a migration (to create the database table) for similar assignments.&lt;br /&gt;
&lt;br /&gt;
By default, every assignment is similar to itself (assume it’s id is X). So, after updating a response’s visibility, we add a new entry in the similar_assignments table: (assignment_id = X, similar_for = X, association_intent = “Review”). This addition is done only after confirming for non-existence, as one can infer from the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private&lt;br /&gt;
	def update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		if visibility == approved_as_sample&lt;br /&gt;
			ids = SimilarAssignment.where(:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			if ids.empty?&lt;br /&gt;
				SimilarAssignment.create({:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if visibility == rejected_as_sample or visibility == _private&lt;br /&gt;
			response_map_ids = ResponseMap.where(:reviewed_object_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			response_ids = Response.where(:map_id =&amp;gt; response_map_ids, :visibility =&amp;gt; approved_as_sample)&lt;br /&gt;
			if response_ids.empty?&lt;br /&gt;
				SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).destroy_all&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The power user visits a review response page expecting to mark some reviews as samples and then link or unlink the assignment associated with the review to his / her other assignments. To provide the linking functionality, we have provided a clickable text  “ Use as Samples for More Assignments” at the top right corner of the page as shown below.&lt;br /&gt;
&lt;br /&gt;
[[for use as sample for more assignment]]&lt;br /&gt;
&lt;br /&gt;
The appearance or non-appearance of this text is conditional. It only appears when there is at least one sample review for the current assignment. So, to decide this, we have queried for those assignments for which this assignment is a similar one, and checked on the size of the query result. The size is then checked in popup_controller to set an instance variable popup_show to a boolean value. The view uses this to render or not render the clickable “Use as Samples for More Assignments” text.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_similar_assignment_ids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def get_similar_assignment_ids(assignment_id)&lt;br /&gt;
      SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).pluck(:is_similar_for)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet of popup_controller line 84&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@page_size = popup_page_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On click of this text, we open a popup that lists out (with a checkbox alongside each list entry) the candidate assignments that this assignment can be similar for (these are unchecked), and assignments that it is already similar for (these are checked). For example, assume that the power user is viewing the response page of assignment X. Assume we have entries (X,Y,”review”) and (X,Z,”review”) in similar_assignments table. Then, the popup list will have the assignments Y and Z with a checkbox against each of them ticked, and all the other assignments that the current user has access to, with a checkbox against each of them unticked.&lt;br /&gt;
&lt;br /&gt;
The popup and the data that go with it are fetched on demand. So, the assignment list need not be a part of the first render of the page itself, as the inherent querying would slow down page load time. Therefore, on click, we fetch the list by an AJAX request (we have given appropriate error messages below the clickable text for the rare eventuality of any server-side error or empty response).&lt;br /&gt;
&lt;br /&gt;
This request GET “/similar_assignments/:id” is again authenticated in similar_assignments_controller, get method. Same validation ideas as explained earlier are used. Only the assignment’s course instructor and TAs, admin, and super-admin should be able to fetch this data, while others need not have access to it.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # GET /similar_assignments/:id&lt;br /&gt;
def get&lt;br /&gt;
    @assignment_id = params[:id]&lt;br /&gt;
    ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
    WHERE visibility=2 AND reviewed_object_id =&amp;quot;+@assignment_id.to_s).ids&lt;br /&gt;
    if ids.empty?&lt;br /&gt;
    render json: {&amp;quot;success&amp;quot;=&amp;gt;false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Please mark atleast one review as sample&amp;quot;}&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    begin&lt;br /&gt;
      if current_user.role.id == Role.student.id&lt;br /&gt;
        throw Exception.new&lt;br /&gt;
      end&lt;br /&gt;
    @similar_assignments = SimilarAssignment.where(:assignment_id =&amp;gt; @assignment_id).&lt;br /&gt;
    where.not(:is_similar_for=&amp;gt;@assignment_id).order(&amp;quot;created_at DESC&amp;quot;).pluck(:is_similar_for)&lt;br /&gt;
    rescue ActiveRecord::RecordNotFound =&amp;gt; e&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Resource not found&amp;quot;}&lt;br /&gt;
    rescue Exception&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unauthorized&amp;quot;}&lt;br /&gt;
    else&lt;br /&gt;
      @res = get_asssignments_set(@similar_assignments)&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;values&amp;quot; =&amp;gt; @res}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The get method fetches similar assignment ids and passes them on to get_asssignments_set of similar_assignments_helper. This method queries for all assignments (except the ones passed in its parameter list) that the current user is allowed to access and returns a list of hash objects which are used by the caller (the on-success function of the AJAX request). Each hash object contains assignment name, id, it’s course name, and whether it’s a similar assignment or not. Following code snippets demonstrates this:&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_asssignments_set method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_asssignments_set(selected)&lt;br /&gt;
    all_assignments = get_assignments_based_on_role&lt;br /&gt;
    assignment_array = []&lt;br /&gt;
    courses = get_courses_based_on_role&lt;br /&gt;
    all_assignments.each {&lt;br /&gt;
        |assignment|&lt;br /&gt;
      course_id = assignment.course_id&lt;br /&gt;
      if(course_id.nil?)&lt;br /&gt;
       next&lt;br /&gt;
      end&lt;br /&gt;
      if (selected.include? assignment.id)&lt;br /&gt;
        hash1 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; true, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash1)&lt;br /&gt;
      else&lt;br /&gt;
        hash2 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; false, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash2)&lt;br /&gt;
      end&lt;br /&gt;
    }&lt;br /&gt;
    return assignment_array&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_assignments_based_on_role method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_assignments_based_on_role()&lt;br /&gt;
    role = current_user.role.id&lt;br /&gt;
    page = params[:page]&lt;br /&gt;
    assignment_id = params[:id].to_i&lt;br /&gt;
    if page.nil?&lt;br /&gt;
      page = 0&lt;br /&gt;
    end&lt;br /&gt;
    _offset = page.to_i * popup_page_size&lt;br /&gt;
    case role&lt;br /&gt;
      when Role.ta.id&lt;br /&gt;
        course_ids = TaMapping.where(:ta_id =&amp;gt; current_user.id).pluck(:course_id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
          where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      when Role.instructor.id&lt;br /&gt;
        course_ids = Course.where(:instructor_id =&amp;gt; current_user.id).pluck(:id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
           where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        @all_assignments = []&lt;br /&gt;
    end&lt;br /&gt;
    @all_assignments&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The query result can be prohibitively large. This calls for pagination.&lt;br /&gt;
&lt;br /&gt;
Pagination at the server side is about performing the same query as a non-pagination implementation, with an addition: limit and offset. Limit denotes the size of a page, and offset denotes a start index, and is calculated as page size * page number. Page size is a constant defined in similar_assignments_constants.&lt;br /&gt;
&lt;br /&gt;
We had two options for response and rendering:&lt;br /&gt;
Construct the popup list HTML from the query results and respond with this HTML.&lt;br /&gt;
Respond with JSON, and build the HTML client side.&lt;br /&gt;
&lt;br /&gt;
Responding with HTML from server-side is expensive, as the byte size of the HTTP response would be significantly larger than JSON. Thus, we chose the second option.&lt;br /&gt;
&lt;br /&gt;
Since HTTP is stateless, the server has no way to maintain a running counter of page number. Therefore, keeping track of page number must be the responsibility of the client (browser JavaScript) who must pass it as a request parameter while the server simply reads it and assumes its lack of existence as page number 0. The following snippet demonstrates this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of response.js line 103-130&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fetchAssignments:function(){&lt;br /&gt;
    var self = this;&lt;br /&gt;
    var ajaxUrl = &amp;quot;/similar_assignments/&amp;quot;+assignmentId;&lt;br /&gt;
    if(this.currentPageNumber &amp;gt; 0){&lt;br /&gt;
        ajaxUrl += &amp;quot;?page=&amp;quot;+this.currentPageNumber;&lt;br /&gt;
    }&lt;br /&gt;
    jQuery.ajax({&lt;br /&gt;
        &amp;quot;url&amp;quot;:ajaxUrl,&lt;br /&gt;
        &amp;quot;type&amp;quot;:&amp;quot;GET&amp;quot;,&lt;br /&gt;
        &amp;quot;dataType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;responseType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;beforeSend&amp;quot;:function(){&lt;br /&gt;
            self.hideSuccess();&lt;br /&gt;
            self.hideError();&lt;br /&gt;
                    },&lt;br /&gt;
        &amp;quot;success&amp;quot;:function(result){&lt;br /&gt;
            if(result.success &amp;amp;&amp;amp; result.values.length){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }else if(result.success &amp;amp;&amp;amp; self.currentPageNumber == 0){&lt;br /&gt;
                self.onFetchFail(&amp;quot;Cannot link this to any assignment!&amp;quot;);&lt;br /&gt;
            }else if(result.success){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }&lt;br /&gt;
            else{&lt;br /&gt;
            self.onFetchFail(result.error);&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;failure&amp;quot;: self.onFetchFail,&lt;br /&gt;
        &amp;quot;error&amp;quot;:self.onFetchFail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have avoided maintaining the constant value of page size once on server side (in similar_assignments_constants) and once on the client side (JS variable). The initial render of the page creates a hidden HTML element that contains the page size, and once the document is ready, response.js selects that element, reads its value into a variable, and deletes that HTML element. This prevents having a page size in the HTML page-source, and more importantly, complies with the DRY principle. Page size should be changed in one function only - and that is in similar_assignments_constants as explained earlier.&lt;br /&gt;
&lt;br /&gt;
From the response JSON containing an array of objects (that are going to be rendered as list items), we have constructed the HTML list. Each list item maintains its assignment id in its HTML data attribute. The following snippet shows this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response.js lines 67-78&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addToList:function(assignment){&lt;br /&gt;
        var assignmentId = assignment.id;&lt;br /&gt;
        var title = assignment.title;&lt;br /&gt;
        var course = assignment.course_name;&lt;br /&gt;
        var displayText = &amp;quot;&amp;lt;strong&amp;gt;&amp;quot;+course+&amp;quot;: &amp;lt;/strong&amp;gt;&amp;quot; +title;&lt;br /&gt;
        var checked = assignment.checked;&lt;br /&gt;
        var newRow = this.template.clone();&lt;br /&gt;
        newRow.removeClass(&amp;quot;hide&amp;quot;).find(&amp;quot;input&amp;quot;).attr(&amp;quot;data-id&amp;quot;,assignmentId).attr(&amp;quot;checked&amp;quot;,checked);&lt;br /&gt;
        newRow.find(&amp;quot;span&amp;quot;).html(displayText).on(&amp;quot;click&amp;quot;,function(){&lt;br /&gt;
            newRow.find(&amp;quot;input&amp;quot;).click();&lt;br /&gt;
        });&lt;br /&gt;
        this.list.append(newRow.removeAttr(&amp;quot;id&amp;quot;));&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
_________________________________________A snapshot of the popup is shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The “More” button (shown in the snapshot above) is used to fetch the next set of results.&lt;br /&gt;
&lt;br /&gt;
After a finite number of requests, the client receives a lesser number of results than expected. This is when pagination must stop (since there are no more results). This is achieved by the object AssignmentsPopup (in our response.js file) - it maintains the page size and current page number. The more button is now replaced by a text “No more results” and it’s on-click functionality is turned off.&lt;br /&gt;
&lt;br /&gt;
______________________________________________Screenshot of popup with “No more results”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further, we have implemented this as a plug-and-play service. By reusing the same popup HTML and the AssignmentsPopup variable, the entire popup can be made a part of any Expertiza page.&lt;br /&gt;
&lt;br /&gt;
The page makes no requests on closing the popup, or on clicking Submit without checking any unchecked list item or unchecking any checked list item. It submits only if there is an overall difference in what items are checked and what are not.&lt;br /&gt;
&lt;br /&gt;
Click of “Submit” makes another AJAX POST request to “/similar_assignments/create/:id” with two params in the post JSON data:&lt;br /&gt;
“checked” - an array of assignment ids that were checked in the list but unchecked while opening the popup&lt;br /&gt;
“unchecked” - an array of assignment ids that were unchecked in the list but checked while opening the popup&lt;br /&gt;
&lt;br /&gt;
Either of these params may be empty, depending on the user’s actions, but not both (if both were empty, we simply close the popup without submitting). However, this optimization is only client side. Server side logic must still check for duplicates - that is, an assignment id under “checked” is already a part of similar_assignments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let current assignment id be X. For each of the checked assignment ids Ci in {C1,C2,...,Cn}, we have checked if there are entries (X,Ci) in similar_assignments table, and if not, then created that entry. Similarly, for each of the unchecked assignment ids Ui in {U1,U2,...,Um}, we have deleted the entry (X,Ui) from similar_assignments.&lt;br /&gt;
&lt;br /&gt;
On a successful update, the client closes the popup and prints a success message.&lt;br /&gt;
&lt;br /&gt;
_________________________________________________________________________________________Snapshot with success message&lt;br /&gt;
&lt;br /&gt;
So far, power users have marked reviews as samples and linked assignments. Now, students need to view these samples. A student would view these sample reviews before writing their review on somebody else’s work. Therefore, we have added a link “View Sample Reviews” to view the list of sample reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here.&amp;lt;pending&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, power users might also want to view samples. We have provided the same link on the following page too.&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here&lt;br /&gt;
&lt;br /&gt;
This page is rendered by the index method in sample_reviews_controller. It is a list of links to sample reviews. The layout of this page is common for users, as long as they are logged in. Non-logged-in or anonymous visitors are redirected to the Expertiza home page. ‘index’ calls a method redirect_anonymous_user in sample_reviews_helper to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of sample_reviews_helper&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def redirect_anonymous_user&lt;br /&gt;
    current_user = session[:user]&lt;br /&gt;
    if current_user.nil?&lt;br /&gt;
        redirect_to &amp;quot;/&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The list of available samples has no upper bound on its size. Yet again, pagination solves this problem. But unlike the case of the popup discussed earlier, the response type differs. A request without a ‘page’ parameter in its URL is a request for the web-page and should, therefore, render HTML, while the same request URL with the ‘page’ parameter is a request for more content, and should, therefore, render JSON. The following snippet from the index method demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample_reviews_controller - index method - add the if-else just before return statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def index&lt;br /&gt;
    redirect_anonymous_user&lt;br /&gt;
    @assignment_id = params[:id].to_i&lt;br /&gt;
    page_number = params[:page].to_i&lt;br /&gt;
    if page_number.nil?&lt;br /&gt;
        page_number = 0&lt;br /&gt;
    end&lt;br /&gt;
    @page_size = 8&lt;br /&gt;
    similar_assignment_ids = get_similar_assignment_ids(@assignment_id)&lt;br /&gt;
    @response_ids = []&lt;br /&gt;
    similar_assignment_ids.each do |id|&lt;br /&gt;
        _offset = page_number * @page_size&lt;br /&gt;
        ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
        WHERE visibility=2 AND reviewed_object_id = &amp;quot;+id.to_s+&lt;br /&gt;
        &amp;quot; ORDER BY responses.created_at LIMIT &amp;quot;+@page_size.to_s+&amp;quot; OFFSET &amp;quot;+_offset.to_s ).ids&lt;br /&gt;
        @response_ids += ids&lt;br /&gt;
    end&lt;br /&gt;
    @links = generate_links(@response_ids)&lt;br /&gt;
    if page_number == 0&lt;br /&gt;
        @course_assignment_name = get_course_assignment_name(@assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
        render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;sampleReviews&amp;quot; =&amp;gt; @links}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During this first render itself, we have also identified whether more results can exist. The “More” button only appears if the number of sample review links being rendered is equal to the page size, as shown in a snippet of views/sample_reviews/index.html.erb below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snip of Lines 12-15&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @links.size == @page_size %&amp;gt;&lt;br /&gt;
    &amp;lt;h5 style=&amp;quot;cursor:pointer;text-align: center;&amp;quot; id=&amp;quot;more_button&amp;quot;&amp;gt;More +&amp;lt;/h5&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clicking the “More” button now makes the same request as the page’s URL, but with the parameter ‘page’. In that case, the response is JSON, which is used by the caller (JavaScript Ajax) to add more rows to the page. If the number of rows is lesser than expected, the More text is changed, its click listener is turned off, and no more requests are made, demonstrated by the snippet of sample_review.js below.&lt;br /&gt;
&lt;br /&gt;
Code snip of Line 25-35&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i in result.sampleReviews)&lt;br /&gt;
{&lt;br /&gt;
    currentNumberOfRows++;&lt;br /&gt;
    var review = result.sampleReviews[i];&lt;br /&gt;
    var newRow = listTemplate.clone();&lt;br /&gt;
    newRow.removeClass(&amp;quot;hide&amp;quot;).removeAttr(&amp;quot;id&amp;quot;).find(&amp;quot;a&amp;quot;).&lt;br /&gt;
    html(&amp;quot;Sample Review &amp;quot;+currentNumberOfRows).attr(&amp;quot;href&amp;quot;,review);&lt;br /&gt;
    ulList.append(newRow);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if(responseSize &amp;lt; pageSize){&lt;br /&gt;
self.html(&amp;quot;No more results!&amp;quot;).off().css({&amp;quot;cursor&amp;quot;:&amp;quot;default&amp;quot;});&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
pageNumber++;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each of the list items on the page is a link, which takes the user to /sample_reviews/:id. On this page, we fetch the question-answer pairs corresponding to the object having the id given in the URL and print it out in the form of a table.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User (TA/Instructor/Admin/Super Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student, with a &amp;quot;Make as sample&amp;quot; button on the right of every review.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment task page is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to open the reviews summary page (at /student_review).&lt;br /&gt;
# Below the heading &amp;quot;Reviews for ...&amp;quot;, click on the &amp;quot;Show sample reviews&amp;quot; link.&lt;br /&gt;
# This opens a page where the student can view all sample reviews for that assignment.&lt;br /&gt;
# Use the browser's back button to go back to Assignment review page.&lt;br /&gt;
# Chose to review any of the teams' assignments that are displayed.&lt;br /&gt;
# Select a team for review and fill in the review.&lt;br /&gt;
# Before submitting the review, select the checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted has been made public.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RSpec Tests'''&lt;br /&gt;
Below are the Rpsec tests that have been added to test the edge cases when a user tries to get access to the data using cloned requests:&lt;br /&gt;
# If an anonymous user tries to view the sample reviews page he/she will be redirected to home page.&lt;br /&gt;
# If an anonymous user tries to view the details of a particular sample review, he/she will be redirected to home page.&lt;br /&gt;
# If a user tries to view the sample review of a particular assignment for which there are no sample reviews, he/she will be redirected to home page.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121226</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=121226"/>
		<updated>2018-12-07T23:23:01Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach &amp;amp; Design ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for &amp;quot;similar_assignments&amp;quot; and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DB Design'''&lt;br /&gt;
&lt;br /&gt;
Currently, the Expertiza database design does not maintain any link between different assignments. An assignment of the current semester is completely independent of any other assignment of any other course having similar or exact objectives. For example, in a course C, the assignment named A1 in a semester Sx has no association to the same assignment given in an earlier semester Sy.&lt;br /&gt;
&lt;br /&gt;
Since our task involves using reviews from the past as samples for the present, we should create this association as a new table. Further, reviews may not be the only intention to associate assignments with each other, as future requirements might require associating them on other criteria too. Thus, we find it appropriate to name the table as &amp;quot;similar_assignments&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The table structure is defined [http://wiki.expertiza.ncsu.edu/index.php/Similar_assignments here].&lt;br /&gt;
&lt;br /&gt;
This table can be visualized as a directed graph where vertices represent assignments. An edge (u,v) with a label L means u is similar to v for the intent of association, L.&lt;br /&gt;
&lt;br /&gt;
Consider a row (id = x, assignment_id = Ak, is_similar_for = An, association_intent = &amp;quot;review&amp;quot;). This means, given the intent of association as &amp;quot;review&amp;quot;, assignment Ak was chosen as a similar assignment for assignment An. That is, while marking some review for An as a sample, the instructor opted to have reviews of Ak as samples for An as well.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:UseCase.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Power Users:''' Instructors, TAs, Admins and Super Admins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''More details about each point mentioned in the approach section will be updated after the implementation.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
We have added a new column in the ‘responses’ table (in the database), namely, ‘visibility’. &lt;br /&gt;
Visibility can have 4 values as listed below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table showing list of visibility values and the properties&lt;br /&gt;
! Visibility &lt;br /&gt;
! Properties &lt;br /&gt;
|-&lt;br /&gt;
| 0 || Response is private. This is the default value.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 2 || The response which was in the review has been approved as an example (that is, it has been marked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || The response which was either in the review or approved earlier, has now been rejected as an example (it has been unmarked as a sample)&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We have maintained these constants in a new file at helpers/response_constants.rb.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
module ResponseConstants&lt;br /&gt;
	def _private&lt;br /&gt;
		0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def in_review&lt;br /&gt;
		1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def approved_as_sample&lt;br /&gt;
		2&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	def rejected_as_sample&lt;br /&gt;
		3&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the existing implementation of reviews, when a student starts a review (but hasn’t filled any text or ratings yet), a response gets created in the database. This response has a default visibility of 0.&lt;br /&gt;
&lt;br /&gt;
We have provided a checkbox (an HTML input node with attribute ‘type’ as ‘checkbox’) for the student to consent for his / her review to be used as an example, with values 0 and 1 for unchecked and checked respectively. This value is used to update the response object as part of the form submission.&lt;br /&gt;
&lt;br /&gt;
However, a student might want to remove their consent or give their consent, for a review that is already submitted. So, in the page where student views his / her own response, we have added the same HTML checkbox. On checking or unchecking the checkbox, the visibility field in the corresponding response object in the database gets updated.Consider this as case 1.&lt;br /&gt;
&lt;br /&gt;
Now when a power user looks at a review (at url , which is an HTML rendering of a ResponseMap containing Responses), he/she must be able to approve and reject responses which students have consented (offered) to be made visible to all. This is done by providing a button “Mark as Sample” or “Remove as Sample”. Responses without consent will not have any button.&lt;br /&gt;
&lt;br /&gt;
These HTML changes appear in views/popup/team_users_popup.html.haml&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if instance_variable_get('@sample_button_'+round.to_s)&lt;br /&gt;
        %div{:class=&amp;gt;'col-md-12 mark-delete-sample '+'round'+round.to_s}&lt;br /&gt;
          %h3{:class=&amp;gt;'col-md-10'} &amp;quot;Reviewed by #{User.find(@reviewer_id).fullname} (Round #{round})&amp;quot;&lt;br /&gt;
          %div{:class=&amp;gt;'col-md-2'}&lt;br /&gt;
&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@mark_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':2, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Mark as Sample&lt;br /&gt;
            %button{:class=&amp;gt;'col-md-12 mark-unmark-sample-button '+instance_variable_get('@remove_as_sample_'+round.to_s),&lt;br /&gt;
                   :data=&amp;gt;{'visibility':3, 'response_id':instance_variable_get('@response_id_round_' + round.to_s),'round':round} } Remove as Sample&lt;br /&gt;
&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_fail_&amp;quot;+round.to_s}&lt;br /&gt;
            %span{:class=&amp;gt;&amp;quot;hide col-md-12 mark-unmark-sample-result success&amp;quot;, :id=&amp;gt;&amp;quot;mark_unmark_success_&amp;quot;+round.to_s}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Clicking on “Mark as Sample” or “Unmark as Sample” changes the visibility of the response to 2 or 3 respectively. Like case 1 mentioned above, this is another situation where the visibility needs to be updated when there is a page event.&lt;br /&gt;
&lt;br /&gt;
Both these cases are event-based and require to make an HTTP request from the browser and handle the response while staying on the same page. Therefore, according to standard practice, an AJAX request must be initiated on click of the button or checkbox. The request needs two parameters - response id, and the updated value of visibility. User-identifying data is sent by default in HTTP header cookies (as in any usual HTTP request).&lt;br /&gt;
&lt;br /&gt;
To handle these requests, we have created a sample_reviews controller with a method update_visibility. Within the method, we first check whether the request parameters are valid, and then proceed to check whether the current user (identified by session id) should be allowed to edit the response object to the visibility value passed in the request.&lt;br /&gt;
&lt;br /&gt;
We have validated requests in this manner since HTTP is stateless and requests can easily be cloned (a browser need not be the only client making requests). For example, one could simply copy the request as a cURL, change the session id in the HTTP header to a student’s session, and pass alternative values of visibility (say 2, meaning, approved as a sample) in the request. Such requests should be identified as unauthorized requests, while requests which want to update visibility to a value that’s not allowed need to be rejected as bad requests.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def update_visibility&lt;br /&gt;
	begin&lt;br /&gt;
	visibility = params[:visibility] #response object consists of visibility in string format&lt;br /&gt;
	if(visibility.nil?)&lt;br /&gt;
	raise StandardError.new(&amp;quot;Missing parameter 'visibility'&amp;quot;)&lt;br /&gt;
        end&lt;br /&gt;
	visibility = visibility.to_i&lt;br /&gt;
&lt;br /&gt;
	if not (_private..rejected_as_sample).include? visibility&lt;br /&gt;
		raise StandardError.new(&amp;quot;Invalid value for parameter 'visibility'&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	@@response_id = params[:id]&lt;br /&gt;
	response_map_id = Response.find(@@response_id).map_id&lt;br /&gt;
	response_map = ResponseMap.find(response_map_id)&lt;br /&gt;
	assignment_id = response_map.reviewed_object_id&lt;br /&gt;
	is_admin = [Role.administrator.id,Role.superadministrator.id].include? current_user.role.id&lt;br /&gt;
	if is_admin&lt;br /&gt;
		Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
		update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	course_id = Assignment.find(assignment_id).course_id&lt;br /&gt;
	instructor_id = Course.find(course_id).instructor_id&lt;br /&gt;
	ta_ids = []&lt;br /&gt;
	if current_user.role.id == Role.ta.id&lt;br /&gt;
	        ta_ids = TaMapping.where(course_id).ids # do this query only if current user is ta&lt;br /&gt;
	elsif current_user.role.id == Role.student.id&lt;br /&gt;
		# find if this student id is the same as the response reviewer id&lt;br /&gt;
		# and that visiblity is 0 or 1 and nothing else.&lt;br /&gt;
		# if anything fails, return failure&lt;br /&gt;
		if visibility &amp;gt; in_review&lt;br /&gt;
		           render json:{&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Not allowed&amp;quot;}&lt;br /&gt;
			        return&lt;br /&gt;
			    end&lt;br /&gt;
		reviewer_user_id = AssignmentParticipant.find(response_map.reviewer_id).user_id&lt;br /&gt;
		if reviewer_user_id != current_user.id&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
			 	return&lt;br /&gt;
		         end&lt;br /&gt;
&lt;br /&gt;
	elsif not ([instructor_id] + ta_ids).include? current_user.id&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unathorized&amp;quot;}&lt;br /&gt;
		return&lt;br /&gt;
	end&lt;br /&gt;
	Response.update(@@response_id.to_i, :visibility =&amp;gt; visibility)&lt;br /&gt;
	update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		rescue StandardError =&amp;gt; e&lt;br /&gt;
		render json:{&amp;quot;success&amp;quot; =&amp;gt; false,&amp;quot;error&amp;quot; =&amp;gt; e.message}&lt;br /&gt;
		else&lt;br /&gt;
			render json:{&amp;quot;success&amp;quot; =&amp;gt; true}&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have provided a success or error message text below the button to indicate to the user that the request is completed.&lt;br /&gt;
&lt;br /&gt;
[[file: Mark unmark picssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have used the same request mark_unmark/:id with POST data as {“visibility”:x}, in the student view as well.&lt;br /&gt;
&lt;br /&gt;
This project also required that assignments be linked to each other, as explained in the sections above. To this end, we have created a controller, model, and a migration (to create the database table) for similar assignments.&lt;br /&gt;
&lt;br /&gt;
By default, every assignment is similar to itself (assume it’s id is X). So, after updating a response’s visibility, we add a new entry in the similar_assignments table: (assignment_id = X, similar_for = X, association_intent = “Review”). This addition is done only after confirming for non-existence, as one can infer from the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
private&lt;br /&gt;
	def update_similar_assignment(assignment_id, visibility)&lt;br /&gt;
		if visibility == approved_as_sample&lt;br /&gt;
			ids = SimilarAssignment.where(:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			if ids.empty?&lt;br /&gt;
				SimilarAssignment.create({:is_similar_for =&amp;gt; assignment_id, :association_intent =&amp;gt; intent_review, &lt;br /&gt;
				:assignment_id =&amp;gt; assignment_id})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if visibility == rejected_as_sample or visibility == _private&lt;br /&gt;
			response_map_ids = ResponseMap.where(:reviewed_object_id =&amp;gt; assignment_id).ids&lt;br /&gt;
			response_ids = Response.where(:map_id =&amp;gt; response_map_ids, :visibility =&amp;gt; approved_as_sample)&lt;br /&gt;
			if response_ids.empty?&lt;br /&gt;
				SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).destroy_all&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The power user visits a review response page expecting to mark some reviews as samples and then link or unlink the assignment associated with the review to his / her other assignments. To provide the linking functionality, we have provided a clickable text  “ Use as Samples for More Assignments” at the top right corner of the page as shown below.&lt;br /&gt;
&lt;br /&gt;
[[for use as sample for more assignment]]&lt;br /&gt;
&lt;br /&gt;
The appearance or non-appearance of this text is conditional. It only appears when there is at least one sample review for the current assignment. So, to decide this, we have queried for those assignments for which this assignment is a similar one, and checked on the size of the query result. The size is then checked in popup_controller to set an instance variable popup_show to a boolean value. The view uses this to render or not render the clickable “Use as Samples for More Assignments” text.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_similar_assignment_ids&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def get_similar_assignment_ids(assignment_id)&lt;br /&gt;
      SimilarAssignment.where(:assignment_id =&amp;gt; assignment_id).pluck(:is_similar_for)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code snippet of popup_controller line 84&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
@page_size = popup_page_size&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On click of this text, we open a popup that lists out (with a checkbox alongside each list entry) the candidate assignments that this assignment can be similar for (these are unchecked), and assignments that it is already similar for (these are checked). For example, assume that the power user is viewing the response page of assignment X. Assume we have entries (X,Y,”review”) and (X,Z,”review”) in similar_assignments table. Then, the popup list will have the assignments Y and Z with a checkbox against each of them ticked, and all the other assignments that the current user has access to, with a checkbox against each of them unticked.&lt;br /&gt;
&lt;br /&gt;
The popup and the data that go with it are fetched on demand. So, the assignment list need not be a part of the first render of the page itself, as the inherent querying would slow down page load time. Therefore, on click, we fetch the list by an AJAX request (we have given appropriate error messages below the clickable text for the rare eventuality of any server-side error or empty response).&lt;br /&gt;
&lt;br /&gt;
This request GET “/similar_assignments/:id” is again authenticated in similar_assignments_controller, get method. Same validation ideas as explained earlier are used. Only the assignment’s course instructor and TAs, admin, and super-admin should be able to fetch this data, while others need not have access to it.&lt;br /&gt;
&lt;br /&gt;
Code snippet of get method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # GET /similar_assignments/:id&lt;br /&gt;
def get&lt;br /&gt;
    @assignment_id = params[:id]&lt;br /&gt;
    ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
    WHERE visibility=2 AND reviewed_object_id =&amp;quot;+@assignment_id.to_s).ids&lt;br /&gt;
    if ids.empty?&lt;br /&gt;
    render json: {&amp;quot;success&amp;quot;=&amp;gt;false, &amp;quot;error&amp;quot;=&amp;gt;&amp;quot;Please mark atleast one review as sample&amp;quot;}&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    begin&lt;br /&gt;
      if current_user.role.id == Role.student.id&lt;br /&gt;
        throw Exception.new&lt;br /&gt;
      end&lt;br /&gt;
    @similar_assignments = SimilarAssignment.where(:assignment_id =&amp;gt; @assignment_id).&lt;br /&gt;
    where.not(:is_similar_for=&amp;gt;@assignment_id).order(&amp;quot;created_at DESC&amp;quot;).pluck(:is_similar_for)&lt;br /&gt;
    rescue ActiveRecord::RecordNotFound =&amp;gt; e&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Resource not found&amp;quot;}&lt;br /&gt;
    rescue Exception&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; false, &amp;quot;error&amp;quot; =&amp;gt; &amp;quot;Unauthorized&amp;quot;}&lt;br /&gt;
    else&lt;br /&gt;
      @res = get_asssignments_set(@similar_assignments)&lt;br /&gt;
      render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;values&amp;quot; =&amp;gt; @res}&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The get method fetches similar assignment ids and passes them on to get_asssignments_set of similar_assignments_helper. This method queries for all assignments (except the ones passed in its parameter list) that the current user is allowed to access and returns a list of hash objects which are used by the caller (the on-success function of the AJAX request). Each hash object contains assignment name, id, it’s course name, and whether it’s a similar assignment or not. Following code snippets demonstrates this:&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_asssignments_set method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_asssignments_set(selected)&lt;br /&gt;
    all_assignments = get_assignments_based_on_role&lt;br /&gt;
    assignment_array = []&lt;br /&gt;
    courses = get_courses_based_on_role&lt;br /&gt;
    all_assignments.each {&lt;br /&gt;
        |assignment|&lt;br /&gt;
      course_id = assignment.course_id&lt;br /&gt;
      if(course_id.nil?)&lt;br /&gt;
       next&lt;br /&gt;
      end&lt;br /&gt;
      if (selected.include? assignment.id)&lt;br /&gt;
        hash1 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; true, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash1)&lt;br /&gt;
      else&lt;br /&gt;
        hash2 = {:title =&amp;gt; assignment.name, :course_name =&amp;gt; courses[course_id], :checked =&amp;gt; false, :id =&amp;gt; assignment.id}&lt;br /&gt;
        assignment_array.push(hash2)&lt;br /&gt;
      end&lt;br /&gt;
    }&lt;br /&gt;
    return assignment_array&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snippet of get_assignments_based_on_role method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def get_assignments_based_on_role()&lt;br /&gt;
    role = current_user.role.id&lt;br /&gt;
    page = params[:page]&lt;br /&gt;
    assignment_id = params[:id].to_i&lt;br /&gt;
    if page.nil?&lt;br /&gt;
      page = 0&lt;br /&gt;
    end&lt;br /&gt;
    _offset = page.to_i * popup_page_size&lt;br /&gt;
    case role&lt;br /&gt;
      when Role.ta.id&lt;br /&gt;
        course_ids = TaMapping.where(:ta_id =&amp;gt; current_user.id).pluck(:course_id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
          where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      when Role.instructor.id&lt;br /&gt;
        course_ids = Course.where(:instructor_id =&amp;gt; current_user.id).pluck(:id)&lt;br /&gt;
        @all_assignments = Assignment.where(:course_id =&amp;gt; course_ids).&lt;br /&gt;
           where.not(:id=&amp;gt;assignment_id).limit(popup_page_size).offset(_offset).order(&amp;quot;created_at DESC&amp;quot;)&lt;br /&gt;
      else&lt;br /&gt;
        @all_assignments = []&lt;br /&gt;
    end&lt;br /&gt;
    @all_assignments&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The query result can be prohibitively large. This calls for pagination.&lt;br /&gt;
&lt;br /&gt;
Pagination at the server side is about performing the same query as a non-pagination implementation, with an addition: limit and offset. Limit denotes the size of a page, and offset denotes a start index, and is calculated as page size * page number. Page size is a constant defined in similar_assignments_constants.&lt;br /&gt;
&lt;br /&gt;
We had two options for response and rendering:&lt;br /&gt;
Construct the popup list HTML from the query results and respond with this HTML.&lt;br /&gt;
Respond with JSON, and build the HTML client side.&lt;br /&gt;
&lt;br /&gt;
Responding with HTML from server-side is expensive, as the byte size of the HTTP response would be significantly larger than JSON. Thus, we chose the second option.&lt;br /&gt;
&lt;br /&gt;
Since HTTP is stateless, the server has no way to maintain a running counter of page number. Therefore, keeping track of page number must be the responsibility of the client (browser JavaScript) who must pass it as a request parameter while the server simply reads it and assumes its lack of existence as page number 0. The following snippet demonstrates this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of response.js line 103-130&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fetchAssignments:function(){&lt;br /&gt;
    var self = this;&lt;br /&gt;
    var ajaxUrl = &amp;quot;/similar_assignments/&amp;quot;+assignmentId;&lt;br /&gt;
    if(this.currentPageNumber &amp;gt; 0){&lt;br /&gt;
        ajaxUrl += &amp;quot;?page=&amp;quot;+this.currentPageNumber;&lt;br /&gt;
    }&lt;br /&gt;
    jQuery.ajax({&lt;br /&gt;
        &amp;quot;url&amp;quot;:ajaxUrl,&lt;br /&gt;
        &amp;quot;type&amp;quot;:&amp;quot;GET&amp;quot;,&lt;br /&gt;
        &amp;quot;dataType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;responseType&amp;quot;:&amp;quot;json&amp;quot;,&lt;br /&gt;
        &amp;quot;beforeSend&amp;quot;:function(){&lt;br /&gt;
            self.hideSuccess();&lt;br /&gt;
            self.hideError();&lt;br /&gt;
                    },&lt;br /&gt;
        &amp;quot;success&amp;quot;:function(result){&lt;br /&gt;
            if(result.success &amp;amp;&amp;amp; result.values.length){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }else if(result.success &amp;amp;&amp;amp; self.currentPageNumber == 0){&lt;br /&gt;
                self.onFetchFail(&amp;quot;Cannot link this to any assignment!&amp;quot;);&lt;br /&gt;
            }else if(result.success){&lt;br /&gt;
                self.onFetchSuccess(result.values);&lt;br /&gt;
            }&lt;br /&gt;
            else{&lt;br /&gt;
            self.onFetchFail(result.error);&lt;br /&gt;
            }&lt;br /&gt;
        },&lt;br /&gt;
        &amp;quot;failure&amp;quot;: self.onFetchFail,&lt;br /&gt;
        &amp;quot;error&amp;quot;:self.onFetchFail&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We have avoided maintaining the constant value of page size once on server side (in similar_assignments_constants) and once on the client side (JS variable). The initial render of the page creates a hidden HTML element that contains the page size, and once the document is ready, response.js selects that element, reads its value into a variable, and deletes that HTML element. This prevents having a page size in the HTML page-source, and more importantly, complies with the DRY principle. Page size should be changed in one function only - and that is in similar_assignments_constants as explained earlier.&lt;br /&gt;
&lt;br /&gt;
From the response JSON containing an array of objects (that are going to be rendered as list items), we have constructed the HTML list. Each list item maintains its assignment id in its HTML data attribute. The following snippet shows this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Response.js lines 67-78&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
addToList:function(assignment){&lt;br /&gt;
        var assignmentId = assignment.id;&lt;br /&gt;
        var title = assignment.title;&lt;br /&gt;
        var course = assignment.course_name;&lt;br /&gt;
        var displayText = &amp;quot;&amp;lt;strong&amp;gt;&amp;quot;+course+&amp;quot;: &amp;lt;/strong&amp;gt;&amp;quot; +title;&lt;br /&gt;
        var checked = assignment.checked;&lt;br /&gt;
        var newRow = this.template.clone();&lt;br /&gt;
        newRow.removeClass(&amp;quot;hide&amp;quot;).find(&amp;quot;input&amp;quot;).attr(&amp;quot;data-id&amp;quot;,assignmentId).attr(&amp;quot;checked&amp;quot;,checked);&lt;br /&gt;
        newRow.find(&amp;quot;span&amp;quot;).html(displayText).on(&amp;quot;click&amp;quot;,function(){&lt;br /&gt;
            newRow.find(&amp;quot;input&amp;quot;).click();&lt;br /&gt;
        });&lt;br /&gt;
        this.list.append(newRow.removeAttr(&amp;quot;id&amp;quot;));&lt;br /&gt;
    },&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
_________________________________________A snapshot of the popup is shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The “More” button (shown in the snapshot above) is used to fetch the next set of results.&lt;br /&gt;
&lt;br /&gt;
After a finite number of requests, the client receives a lesser number of results than expected. This is when pagination must stop (since there are no more results). This is achieved by the object AssignmentsPopup (in our response.js file) - it maintains the page size and current page number. The more button is now replaced by a text “No more results” and it’s on-click functionality is turned off.&lt;br /&gt;
&lt;br /&gt;
______________________________________________Screenshot of popup with “No more results”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Further, we have implemented this as a plug-and-play service. By reusing the same popup HTML and the AssignmentsPopup variable, the entire popup can be made a part of any Expertiza page.&lt;br /&gt;
&lt;br /&gt;
The page makes no requests on closing the popup, or on clicking Submit without checking any unchecked list item or unchecking any checked list item. It submits only if there is an overall difference in what items are checked and what are not.&lt;br /&gt;
&lt;br /&gt;
Click of “Submit” makes another AJAX POST request to “/similar_assignments/create/:id” with two params in the post JSON data:&lt;br /&gt;
“checked” - an array of assignment ids that were checked in the list but unchecked while opening the popup&lt;br /&gt;
“unchecked” - an array of assignment ids that were unchecked in the list but checked while opening the popup&lt;br /&gt;
&lt;br /&gt;
Either of these params may be empty, depending on the user’s actions, but not both (if both were empty, we simply close the popup without submitting). However, this optimization is only client side. Server side logic must still check for duplicates - that is, an assignment id under “checked” is already a part of similar_assignments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let current assignment id be X. For each of the checked assignment ids Ci in {C1,C2,...,Cn}, we have checked if there are entries (X,Ci) in similar_assignments table, and if not, then created that entry. Similarly, for each of the unchecked assignment ids Ui in {U1,U2,...,Um}, we have deleted the entry (X,Ui) from similar_assignments.&lt;br /&gt;
&lt;br /&gt;
On a successful update, the client closes the popup and prints a success message.&lt;br /&gt;
&lt;br /&gt;
_________________________________________________________________________________________Snapshot with success message&lt;br /&gt;
&lt;br /&gt;
So far, power users have marked reviews as samples and linked assignments. Now, students need to view these samples. A student would view these sample reviews before writing their review on somebody else’s work. Therefore, we have added a link “View Sample Reviews” to view the list of sample reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here.&amp;lt;pending&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly, power users might also want to view samples. We have provided the same link on the following page too.&lt;br /&gt;
&lt;br /&gt;
________________________________________________________________UI screenshot here&lt;br /&gt;
&lt;br /&gt;
This page is rendered by the index method in sample_reviews_controller. It is a list of links to sample reviews. The layout of this page is common for users, as long as they are logged in. Non-logged-in or anonymous visitors are redirected to the Expertiza home page. ‘index’ calls a method redirect_anonymous_user in sample_reviews_helper to achieve this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Snippet of sample_reviews_helper&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def redirect_anonymous_user&lt;br /&gt;
    current_user = session[:user]&lt;br /&gt;
    if current_user.nil?&lt;br /&gt;
        redirect_to &amp;quot;/&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The list of available samples has no upper bound on its size. Yet again, pagination solves this problem. But unlike the case of the popup discussed earlier, the response type differs. A request without a ‘page’ parameter in its URL is a request for the web-page and should, therefore, render HTML, while the same request URL with the ‘page’ parameter is a request for more content, and should, therefore, render JSON. The following snippet from the index method demonstrates this.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sample_reviews_controller - index method - add the if-else just before return statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def index&lt;br /&gt;
    redirect_anonymous_user&lt;br /&gt;
    @assignment_id = params[:id].to_i&lt;br /&gt;
    page_number = params[:page].to_i&lt;br /&gt;
    if page_number.nil?&lt;br /&gt;
        page_number = 0&lt;br /&gt;
    end&lt;br /&gt;
    @page_size = 8&lt;br /&gt;
    similar_assignment_ids = get_similar_assignment_ids(@assignment_id)&lt;br /&gt;
    @response_ids = []&lt;br /&gt;
    similar_assignment_ids.each do |id|&lt;br /&gt;
        _offset = page_number * @page_size&lt;br /&gt;
        ids = Response.joins(&amp;quot;INNER JOIN response_maps ON response_maps.id = responses.map_id &lt;br /&gt;
        WHERE visibility=2 AND reviewed_object_id = &amp;quot;+id.to_s+&lt;br /&gt;
        &amp;quot; ORDER BY responses.created_at LIMIT &amp;quot;+@page_size.to_s+&amp;quot; OFFSET &amp;quot;+_offset.to_s ).ids&lt;br /&gt;
        @response_ids += ids&lt;br /&gt;
    end&lt;br /&gt;
    @links = generate_links(@response_ids)&lt;br /&gt;
    if page_number == 0&lt;br /&gt;
        @course_assignment_name = get_course_assignment_name(@assignment_id)&lt;br /&gt;
    else&lt;br /&gt;
        render json: {&amp;quot;success&amp;quot; =&amp;gt; true, &amp;quot;sampleReviews&amp;quot; =&amp;gt; @links}&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
During this first render itself, we have also identified whether more results can exist. The “More” button only appears if the number of sample review links being rendered is equal to the page size, as shown in a snippet of views/sample_reviews/index.html.erb below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Code snip of Lines 12-15&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if @links.size == @page_size %&amp;gt;&lt;br /&gt;
    &amp;lt;h5 style=&amp;quot;cursor:pointer;text-align: center;&amp;quot; id=&amp;quot;more_button&amp;quot;&amp;gt;More +&amp;lt;/h5&amp;gt;&lt;br /&gt;
&amp;lt;% end %&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clicking the “More” button now makes the same request as the page’s URL, but with the parameter ‘page’. In that case, the response is JSON, which is used by the caller (JavaScript Ajax) to add more rows to the page. If the number of rows is lesser than expected, the More text is changed, its click listener is turned off, and no more requests are made, demonstrated by the snippet of sample_review.js below.&lt;br /&gt;
&lt;br /&gt;
Code snip of Line 25-35&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(var i in result.sampleReviews)&lt;br /&gt;
{&lt;br /&gt;
    currentNumberOfRows++;&lt;br /&gt;
    var review = result.sampleReviews[i];&lt;br /&gt;
    var newRow = listTemplate.clone();&lt;br /&gt;
    newRow.removeClass(&amp;quot;hide&amp;quot;).removeAttr(&amp;quot;id&amp;quot;).find(&amp;quot;a&amp;quot;).&lt;br /&gt;
    html(&amp;quot;Sample Review &amp;quot;+currentNumberOfRows).attr(&amp;quot;href&amp;quot;,review);&lt;br /&gt;
    ulList.append(newRow);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if(responseSize &amp;lt; pageSize){&lt;br /&gt;
self.html(&amp;quot;No more results!&amp;quot;).off().css({&amp;quot;cursor&amp;quot;:&amp;quot;default&amp;quot;});&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
pageNumber++;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each of the list items on the page is a link, which takes the user to /sample_reviews/:id. On this page, we fetch the question-answer pairs corresponding to the object having the id given in the URL and print it out in the form of a table.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User (TA/Instructor/Admin/Super Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student, with a &amp;quot;Make as sample&amp;quot; button on the right of every review.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment task page is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to open the reviews summary page (at /student_review).&lt;br /&gt;
# Below the heading &amp;quot;Reviews for ...&amp;quot;, click on the &amp;quot;Show sample reviews&amp;quot; link.&lt;br /&gt;
# This opens a page where the student can view all sample reviews for that assignment.&lt;br /&gt;
# Use the browser's back button to go back to Assignment review page.&lt;br /&gt;
# Chose to review any of the teams' assignments that are displayed.&lt;br /&gt;
# Select a team for review and fill in the review.&lt;br /&gt;
# Before submitting the review, select the checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted has been made public.&lt;br /&gt;
&lt;br /&gt;
'''RSpec Tests'''&lt;br /&gt;
Rpsec tests have been added to test the following edge cases where an user tries to get access to the data using cloned requests:&lt;br /&gt;
# If an anonymous user tries to view the sample reviews page he/she will be redirected to home page.&lt;br /&gt;
# If an anonymous user tries to view the details of a particular sample review, he/she will be redirected to home page.&lt;br /&gt;
# If a user tries to view the sample review of a particular assignment for which there are no sample reviews, he/she will be redirected to home page.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120322</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120322"/>
		<updated>2018-11-20T18:06:51Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Below are the changes we intend to make: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
==== Below are the changes we intend to make: ====&lt;br /&gt;
# For making a review as a sample for other reviews by power users:&lt;br /&gt;
# For Making a review public by the student:&lt;br /&gt;
&lt;br /&gt;
==== UML - Use Case Diagram ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120321</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120321"/>
		<updated>2018-11-20T18:06:18Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Below are the changes we intend to make: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
# For making a review as a sample for other reviews by power users:&lt;br /&gt;
# For Making a review public by the student:&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120320</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120320"/>
		<updated>2018-11-20T18:05:57Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Below are the changes we intend to make: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
# For making a review as a sample for other reviews:&lt;br /&gt;
# For Making a review public by the student:&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120319</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120319"/>
		<updated>2018-11-20T18:05:37Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Below are the changes we intend to make: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
# For making a review as a sample for other reviews:&lt;br /&gt;
&lt;br /&gt;
# For Making a review public by the student :&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120317</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120317"/>
		<updated>2018-11-20T18:03:50Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Below are the changes we intend to make: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
# For making a review of one assignment as a sample for multiple assignments&lt;br /&gt;
# For Making a review public by the student &lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120316</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120316"/>
		<updated>2018-11-20T18:03:24Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Below are the changes we intend to make: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
# ==== For making a review of one assignment as a sample for multiple assignments ====&lt;br /&gt;
# ==== For Making a review public by the student ====&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120315</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120315"/>
		<updated>2018-11-20T18:02:54Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
==== For making a review of one assignment as a sample for multiple assignments ====&lt;br /&gt;
==== For Making a review public by the student ====&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a Power User(TA/Instructor/Admin)'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120293</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120293"/>
		<updated>2018-11-20T16:57:14Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Below are the changes we intend to make: ===&lt;br /&gt;
==== For making a review of one assignment as a sample for multiple assignments ====&lt;br /&gt;
==== For Making a review public by the student ====&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120292</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120292"/>
		<updated>2018-11-20T16:56:47Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Implementation Details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
'''Below are the changes we intend to make:'''&lt;br /&gt;
=== For making a review of one assignment as a sample for multiple assignments ===&lt;br /&gt;
=== For Making a review public by the student ===&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120291</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120291"/>
		<updated>2018-11-20T16:53:54Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120290</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120290"/>
		<updated>2018-11-20T16:53:37Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120289</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120289"/>
		<updated>2018-11-20T16:52:40Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /*Removing Introduction as it is nit required*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), we give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, we give a popup containing a list of assignments with a checkbox against each of them and a submit button at the end to allow instructors to make sample reviews available for multiple assignments in one go. We perform validation checks also.&lt;br /&gt;
# On submit of the popup, we update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, we give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students will be able to click on one particular review and preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120135</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120135"/>
		<updated>2018-11-16T04:30:37Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Project Tasks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
== Approach ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object.&lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private again. &lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), give a checkbox against every review with public visibility to allow instructors/TAs to select one or more reviews as sample reviews to be available for students.&lt;br /&gt;
# Once the instructor selects and submits some reviews as sample reviews, give a popup with a list of assignments with a checkbox against each and a submit button to allow instructors to make sample reviews available for multiple assignments in one go. Add validation checks also.&lt;br /&gt;
# On submit of the popup, update the similar_assignments table.&lt;br /&gt;
# At the top of student_reviews/list page, give an option for the student to preview all the available sample reviews. &lt;br /&gt;
# Create the MVC setup for this new page to list all the sample reviews. Students should be able to click on one particular review to preview it.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''UML - Use Case Diagram'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Use_Case_Dia.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Other details will be updated after the implementation'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120021</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120021"/>
		<updated>2018-11-14T04:09:00Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
# After clicking on the submit button, the review submitted by the student has been made public.&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
# Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object&lt;br /&gt;
 &lt;br /&gt;
# Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
&lt;br /&gt;
# Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
&lt;br /&gt;
# Add HTML (checkbox) to uncheck the consent such that the reviews becomes private. &lt;br /&gt;
&lt;br /&gt;
# On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), for all reviews with public visibility set, add a button to mark a review as a sample.&lt;br /&gt;
&lt;br /&gt;
# Write HTML for a popup that contains a list (of assignments) with checkboxes against each, and a submit button. Add validations for non-selection.&lt;br /&gt;
&lt;br /&gt;
# Modify view for the instructor/TA to include this popup to make the review available as sample. On submit of popup, update the similar_assignments table.&lt;br /&gt;
&lt;br /&gt;
# At the top of student_reviews/list page, add a link to a new page. &lt;br /&gt;
&lt;br /&gt;
# Create new route, model, view, controller for this new page at 'student_reviews/samples?id=&amp;lt;assignment_id&amp;gt;'. Write HTML to display the list&lt;br /&gt;
of sample reviews.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120019</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120019"/>
		<updated>2018-11-14T04:07:20Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can select the check box that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
1) Consent to make the review public - add a checkbox and an oncheck event handlers (JS) that sets a new field 'visibility' to public of Response object&lt;br /&gt;
 &lt;br /&gt;
2) Change the schema of Responses table (add the new column) and write db migrations.  &lt;br /&gt;
&lt;br /&gt;
3) Create new table, model, view, controller for similar_assignments and validate CRUD operations that access the table.&lt;br /&gt;
&lt;br /&gt;
4) Add HTML (checkbox) to uncheck the consent such that the reviews becomes private. &lt;br /&gt;
&lt;br /&gt;
5) On the &amp;quot;popup/team_users_popup&amp;quot; page (where instructor/TA can view all reviews), for all reviews with public visibility set, add a button to mark a review as a sample.&lt;br /&gt;
&lt;br /&gt;
6) Write HTML for a popup that contains a list (of assignments) with checkboxes against each, and a submit button. Add validations for non-selection.&lt;br /&gt;
&lt;br /&gt;
7) Modify view for the instructor/TA to include this popup to make the review available as sample. On submit of popup, update the similar_assignments table.&lt;br /&gt;
&lt;br /&gt;
8) At the top of student_reviews/list page, add a link to a new page. &lt;br /&gt;
&lt;br /&gt;
9) Create new route, model, view, controller for this new page at 'student_reviews/samples?id=&amp;lt;assignment_id&amp;gt;'. Write HTML to display the list&lt;br /&gt;
of sample reviews.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120017</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120017"/>
		<updated>2018-11-14T04:06:33Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
# On clicking this, it will display all the sample reviews.&lt;br /&gt;
# Student can click on back to go back to Assignment description page.&lt;br /&gt;
# Student can chose to review any of the team's assignment that is displayed.&lt;br /&gt;
# Student selects a team for review and fills in the review.&lt;br /&gt;
# Before submitting the review, student can&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the Git Pull Request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The Live Expertiza Website]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:aagniho@ncsu.edu Amogh Agnihotri Subbanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:ckaidab@ncsu.edu Chinmai Kaidabettu Srinivas]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:smadhur@ncsu.edu Siddu Madhure Jayanna]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:snaramb@ncsu.edu Suhas Naramballi Gururaja]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120005</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=120005"/>
		<updated>2018-11-14T04:01:14Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
# At this point student can click on &amp;quot;Show sample reviews&amp;quot; to view all sample reviews for that assignment.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
=='''Additional Links and References'''==&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1291 Link to the git pull request]&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/chinmaiks/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119998</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119998"/>
		<updated>2018-11-14T03:54:03Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
# Assignment description is displayed.&lt;br /&gt;
# Click on &amp;quot;Other's work&amp;quot; to submit review for other's work.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/chinmaiks/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1291]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119996</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119996"/>
		<updated>2018-11-14T03:52:58Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
# List of assignments is displayed.&lt;br /&gt;
# Click on any assignment for which the review has to be submitted.&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/chinmaiks/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1291]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119995</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119995"/>
		<updated>2018-11-14T03:51:48Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA / Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
'''As a Student'''&lt;br /&gt;
# Log in.&lt;br /&gt;
# Click on Assignments&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
'''To be updated'''&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/chinmaiks/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1291]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119983</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119983"/>
		<updated>2018-11-14T03:44:35Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As a TA/Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
To be updated&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/chinmaiks/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1291]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119978</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119978"/>
		<updated>2018-11-14T03:43:09Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Expected Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As an Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
# A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Current status of Development ==&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
To be updated&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/chinmaiks/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1291]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119976</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119976"/>
		<updated>2018-11-14T03:42:33Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
'''As an Instructor'''&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Current status of Development ==&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
To be updated&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/ashiskumar123/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1169]&lt;br /&gt;
# link to the deployed application [http://ec2-13-59-7-94.us-east-2.compute.amazonaws.com:3000]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119974</id>
		<title>E1867 allow reviewer to say review can be shown to class as an example</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1867_allow_reviewer_to_say_review_can_be_shown_to_class_as_an_example&amp;diff=119974"/>
		<updated>2018-11-14T03:41:47Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a web based open source peer reviewing tool developed and maintained by current and past students of [https://en.wikipedia.org/wiki/North_Carolina_State_University North Carolina State University]. Peer review is a great way for a student to learn how to approach a project and get ideas for their own projects. Currently, there is no way for a student to view another student's work, unless they are reviewing the other student's work.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The objective of this project is to:&lt;br /&gt;
# Add a feature for students to make their reviews 'public', that is, allow other students to view them.&lt;br /&gt;
# Add a feature for TA to select a subset of 'public' reviews, and make those reviews visible as sample reviews of the particular assignment.&lt;br /&gt;
# Add a feature for Instructor to select a subset of 'public' reviews and make those reviews visible as sample reviews of any of his/her assignments in the course.&lt;br /&gt;
# Create a view where the student can see a list of sample reviews of the assignment and have a detailed view of each.&lt;br /&gt;
# Allow the student to toggle the visibility of a review he/she has submitted.&lt;br /&gt;
&lt;br /&gt;
== Expected Flow ==&lt;br /&gt;
# Log in&lt;br /&gt;
# Click on Manage-&amp;gt;Assignments&lt;br /&gt;
# Displays list of Assignments&lt;br /&gt;
# Click View Report/Review for a particular assignment.&lt;br /&gt;
# Displays a list of reviews submitted by students.&lt;br /&gt;
# Click on any review in &amp;quot;team reviewed&amp;quot; column for a particular student.&lt;br /&gt;
# Displays the summary of reviews submitted by that student.&lt;br /&gt;
# Click on &amp;quot;Make as sample&amp;quot; for the intended reviews, which opens a popup that displays a list of all assignments that are a part of the instructor's courses.&lt;br /&gt;
# From this list select all assignments for which the review has to be shown as a sample.&lt;br /&gt;
# Click on 'Submit' after selection (this closes the popup).&lt;br /&gt;
# Navigate to view reviews of that particular assignment and click on &amp;quot;Sample Reviews&amp;quot;.&lt;br /&gt;
A new page is opened that lists out all the sample reviews of the assignment.&lt;br /&gt;
&lt;br /&gt;
During each review, there will be a checkbox that says &amp;quot;I agree to share this review anonymously as an example to the entire class&amp;quot;, and students can decide to check this box or not just before they submit reviews. Behind the scenes, we need to set a &amp;quot;status&amp;quot; field to “public”of the Response object.&lt;br /&gt;
&lt;br /&gt;
== Project Tasks ==&lt;br /&gt;
&lt;br /&gt;
== Current status of Development ==&lt;br /&gt;
In progress&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
To be updated&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
# link to forked repository [https://github.com/ashiskumar123/expertiza]&lt;br /&gt;
# link to the git pull request [https://github.com/expertiza/expertiza/pull/1169]&lt;br /&gt;
# link to the deployed application [http://ec2-13-59-7-94.us-east-2.compute.amazonaws.com:3000]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
# Link to expertiza website: [https://expertiza.ncsu.edu/]&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=119091</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=119091"/>
		<updated>2018-11-09T21:45:41Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page provides a description of the Expertiza based OSS project.&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=='''About Expertiza'''==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project developed using Ruby on Rails framework.Expertiza allows the instructor to create new assignments and customize new or existing assignments.The application allows students to submit and peer-review learning objects (articles, code, web sites, etc)[1].Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
The user (instructor, TA or admin) has to click the ''Add'' button on the course or assignment page to add a new participant to the course or assignment. On click of the button, the browser initiates an AJAX request and gets a response HTML representing success or failure of the action. The failure case was already handled - an error message appears at the top of the page.&lt;br /&gt;
On success, it was observed that, though the HTML for a new table row (representing the just added participant) was part of the response, it was not being appended properly to the page's DOM.&lt;br /&gt;
This is fixed by giving an '''id''' to the ''table'' HTML element, and appending the new row to its ''tbody'' element.&lt;br /&gt;
After appending, we must also ensure that the &amp;quot;Submit&amp;quot; button which is part of the new HTML must be functional. So, an onchange listener is added to the button element (in the file add.js.erb).&lt;br /&gt;
&lt;br /&gt;
  In app/views/shared_scripts/_user_list.html.erb:&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt;table id=&amp;quot;table_list&amp;quot; class=&amp;quot;table table-striped&amp;quot; style=&amp;quot;font-size: 15px&amp;quot;&amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  In app/views/participants/add.js.erb&lt;br /&gt;
  $(&amp;quot;#table_list&amp;quot;).find(&amp;quot;tbody&amp;quot;).append(&lt;br /&gt;
  &amp;quot;&amp;lt;%= j render :partial =&amp;gt; 'participant', :locals =&amp;gt; {participant: @participant, :userid =&amp;gt; @participant.user_id, :controller =&amp;gt; 'participants'} %&amp;gt;&amp;quot;);&lt;br /&gt;
  )&lt;br /&gt;
  $('#'.concat(student_id.toString())).change(function(){&lt;br /&gt;
    $('#button'.concat(student_id.toString())).css(&amp;quot;opacity&amp;quot;,1);&lt;br /&gt;
  });&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) Now suppose ''Instructor6'' logs in and impersonates the student ''student6400'', he will be able to see all the assignment details under his course i.e. all the details of the assignment that was created by ''Instructor6'' himself as well as the assignments created by his TA's.&lt;br /&gt;
&lt;br /&gt;
15) Next, login as student6400 and click on assignments. The student will be able to see all the assignments of all the courses to which he/she is assigned to.&lt;br /&gt;
&lt;br /&gt;
16) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
== Screenshots of the flow ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
14) Next, login as student6400 and click on assignments. The student will be able to see all the assignments of all the courses to which he/she is assigned to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
15) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
[[File:Ins_adding_participant1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
[[File:Added_participant.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118644</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118644"/>
		<updated>2018-11-03T15:07:27Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Issue #1185 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:Ins6 homepage.png]]&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
[[File:Ins_adding_participant1.png]]&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
[[File:Added_participant.png]]&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_participant.png&amp;diff=118643</id>
		<title>File:Added participant.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Added_participant.png&amp;diff=118643"/>
		<updated>2018-11-03T15:05:57Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: uploaded a new version of &amp;amp;quot;File:Added participant.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ins_adding_participant1.png&amp;diff=118642</id>
		<title>File:Ins adding participant1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ins_adding_participant1.png&amp;diff=118642"/>
		<updated>2018-11-03T15:04:24Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118638</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118638"/>
		<updated>2018-11-03T07:14:58Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:Ins6 homepage.png]]&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118637</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118637"/>
		<updated>2018-11-03T07:13:09Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118636</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118636"/>
		<updated>2018-11-03T07:10:20Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118635</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118635"/>
		<updated>2018-11-03T07:08:38Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6_homepage_new.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118634</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118634"/>
		<updated>2018-11-03T07:07:12Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118633</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118633"/>
		<updated>2018-11-03T07:06:22Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: Ins6_entering_student_in_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118632</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118632"/>
		<updated>2018-11-03T07:04:44Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: entering student in impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118631</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118631"/>
		<updated>2018-11-03T07:02:51Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: entering student in impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Ins6_homepage.png&amp;diff=118630</id>
		<title>File:Ins6 homepage.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Ins6_homepage.png&amp;diff=118630"/>
		<updated>2018-11-03T07:02:42Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: uploaded a new version of &amp;amp;quot;File:Ins6 homepage.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118629</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118629"/>
		<updated>2018-11-03T07:00:50Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: entering student in impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118628</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118628"/>
		<updated>2018-11-03T07:00:07Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: entering student in impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118627</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118627"/>
		<updated>2018-11-03T06:58:59Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: /* Screenshots of new feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.png]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.png]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: entering student in impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor4_Page_with_Course.png&amp;diff=118626</id>
		<title>File:Instructor4 Page with Course.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor4_Page_with_Course.png&amp;diff=118626"/>
		<updated>2018-11-03T06:57:48Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: uploaded a new version of &amp;amp;quot;File:Instructor4 Page with Course.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118625</id>
		<title>E1842 Issues Related To Participants</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=E1842_Issues_Related_To_Participants&amp;diff=118625"/>
		<updated>2018-11-03T06:53:35Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==='''Problem Statement'''===&lt;br /&gt;
In Expertiza, an instructor is responsible for adding a participant to his course or assignment. This makes the course material available to the participant (or student per se). Since the instructor has admin rights, he is capable of impersonating the participant. This creates a few problems. This project addresses those issues.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
=='''Issues to be fixed'''==&lt;br /&gt;
&lt;br /&gt;
Issues as described by the problem statement:&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536'''=== &lt;br /&gt;
Once the instructor impersonates the participant, he/she is capable of accessing all of participant’s work, irrespective of the course or the assignment. This raises serious security concerns. &lt;br /&gt;
Suggested solution is to restrict the instructor to view only his coursework. &lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''=== &lt;br /&gt;
After adding a participant, the page has to be manually refreshed to show the name of the participant on the list. This creates a bad user experience and needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Modified Files'''==&lt;br /&gt;
&lt;br /&gt;
1) app/controllers/auth_controller.rb&lt;br /&gt;
&lt;br /&gt;
2) app/controllers/impersonate_controller.rb&lt;br /&gt;
&lt;br /&gt;
3) app/controllers/student_task_controller.rb&lt;br /&gt;
&lt;br /&gt;
4) app/views/participants/add.js.erb&lt;br /&gt;
&lt;br /&gt;
5) app/views/participants/_participant.html.erb&lt;br /&gt;
&lt;br /&gt;
6) app/views/shared_scripts/_user_list.html.erb&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Approach taken to resolve the issues'''==&lt;br /&gt;
&lt;br /&gt;
==='''Issue #536 '''===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once the instructor or teaching assistant impersonates the participant, he/she is capable of accessing all the assignments of this participant irrespective of the course and this raises serious security concerns.&lt;br /&gt;
Ideally, when this happened, the system should have displayed only those assignments to which he/she is assigned as an instructor or teaching assistant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This issue has been fixed by modifying the current implementations of data filtering and session/role handling features.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1. Impersonation and Session Handling:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of all the session data associated with impersonation are handled in auth_controller.rb file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
i] After login, session[:impersonate] value is set to false by default.&lt;br /&gt;
&lt;br /&gt;
  session[:impersonate] = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ii] Once the Instructor tries to impersonate any student, the following actions are performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
a) Assign the instructor/TA data to a session variable and use this data when instructor/TA tries to switch back to their original role.&lt;br /&gt;
      This data is used during data filtering also.&lt;br /&gt;
      &lt;br /&gt;
      original_user = session[:super_user] || session[:user]&lt;br /&gt;
      session[:original_user] = original_user&lt;br /&gt;
&lt;br /&gt;
b) Impersonate flag is set to true and the session's user variable is set to the user data of impersonated student.&lt;br /&gt;
      &lt;br /&gt;
      session[:impersonate] = true&lt;br /&gt;
      session[:user] = user&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
iii] All the session data is cleared off when the user logs out.&lt;br /&gt;
&lt;br /&gt;
    session[:original_user] = nil&lt;br /&gt;
    session[:impersonate] = nil&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2. Data Filtering:'''&lt;br /&gt;
&lt;br /&gt;
Logged in user's role data and impersonation status is used to filter the data for populating the assignments list.&lt;br /&gt;
&lt;br /&gt;
This is implemented in student_task_controller.rb file:&lt;br /&gt;
   &lt;br /&gt;
  // check if the user is impersonating as TA&lt;br /&gt;
  def impersonating_as_ta?&lt;br /&gt;
    original_user = session[:original_user]&lt;br /&gt;
    ta_role = Role.where(name:['Teaching Assistant']).pluck(:id)&lt;br /&gt;
    ta_role.include? original_user.role_id&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  // Filter and populate all the relevant data&lt;br /&gt;
  def list&lt;br /&gt;
    redirect_to(controller: 'eula', action: 'display') if current_user.is_new_user&lt;br /&gt;
    session[:user] = User.find_by(id: current_user.id)&lt;br /&gt;
    @student_tasks = StudentTask.from_user current_user&lt;br /&gt;
    if session[:impersonate] &amp;amp;&amp;amp; !impersonating_as_admin?&lt;br /&gt;
      @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.instructor_id }&lt;br /&gt;
       if impersonating_as_ta?&lt;br /&gt;
        ta_course_ids = TaMapping.where(:ta_id =&amp;gt; session[:original_user].id).pluck(:course_id)&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| ta_course_ids.include?t.assignment.course_id }&lt;br /&gt;
      else&lt;br /&gt;
        @student_tasks = @student_tasks.select {|t| session[:original_user].id == t.assignment.course.instructor_id }&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185 '''===&lt;br /&gt;
&lt;br /&gt;
If a user has an assignment and a topic only then (s)he will be able to advertise for team members to join their team. If a user doesn't have a topic (s)he won't be able to advertise.&lt;br /&gt;
The scenario in which A, B were two users, A with a topic, B without a topic, A joins B's  team but A's topic gets dropped; A,B become a team but with no topic. Such cases are now avoided as we have ensured that without first selecting a topic a user cannot advertise for team members nor can he send invitations to other users to join his team. This is done by quering in the database using inner join between tables-SignUpTopic, signed_up_teams,  team_users; and checking if the user has a topic for a particular assignment. If (s)he has a topic then he'll be able to see the option for advertising for teammates.&lt;br /&gt;
If the assignment doesn't have a topic then the user will be able to send out team invitations.&lt;br /&gt;
Pseudocode representing the logic we have used to modify student_teams_helper.rb:&lt;br /&gt;
&lt;br /&gt;
  StudentTeamsHelper&lt;br /&gt;
    If the concerned assignment has topics&lt;br /&gt;
       return false if their are topics&lt;br /&gt;
    else return true&lt;br /&gt;
&lt;br /&gt;
  User_Has_Topic(user_id, assignment_id)&lt;br /&gt;
    Query the database using inner joins between SignUpTopic, signed_up_teams, team_users&lt;br /&gt;
    rows= number of rows returned by the above query&lt;br /&gt;
    If rows&amp;gt;0&lt;br /&gt;
       return true&lt;br /&gt;
    else&lt;br /&gt;
       return false&lt;br /&gt;
Pseudocode representing the logic we have used to modify view.html.erb:&lt;br /&gt;
&lt;br /&gt;
    If concerned assignment does not have topics OR User_Has_Topic is true&lt;br /&gt;
       Make Invite link visible&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=='''Test Plan'''==&lt;br /&gt;
&lt;br /&gt;
Automated tests cannot be written for this project. Automated tests will only be able to test the functionality of Rails and not the functionality of the amended files.&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/3b649b16e7f7448d9d1ee79ee1448b221d&lt;br /&gt;
----&lt;br /&gt;
https://mymediasite.online.ncsu.edu/online/Play/31dcb783510c4322bcfbc894c71fbdd01d&lt;br /&gt;
----&lt;br /&gt;
==='''''Issue #536'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;br /&gt;
&lt;br /&gt;
'''&lt;br /&gt;
== Screenshots of new feature ==&lt;br /&gt;
'''&lt;br /&gt;
&lt;br /&gt;
1) Login as ''Instructor4''. Add a new assignment ''Assignment_Instructor4'' under the course ''Course 617, Spring 2016''.&lt;br /&gt;
[[File: Instructor4 Page with Course.jpg]]&lt;br /&gt;
&lt;br /&gt;
2) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
[[File: Ins4 with student in course.jpg]]&lt;br /&gt;
&lt;br /&gt;
3) Login as ''Instructor6''. Add a new assignment ''Assignment_Instructor6'' under the course ''Course 517, Spring 2016''.&lt;br /&gt;
[[File:	Ins6 homepage.png]]&lt;br /&gt;
&lt;br /&gt;
4) Make ''student6400'' as the participant of that assignment and logout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5) Click on Manage -&amp;gt; Impersonate User and enter ''student6400'' as the user to be impersonated. &lt;br /&gt;
[[File: entering student in impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
6) After impersonation, ''Instructor6'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins6_result_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
7) We need to login as ''Instructor4'' and verify that ''Instructor4'' is not able to see other assignment details of the other instructors.&lt;br /&gt;
&lt;br /&gt;
8) Login as ''Instructor4''. Click on Manage -&amp;gt; Impersonate user. Enter ''student6400'' as the user to be impersonated.&lt;br /&gt;
[[File: Ins4_impersonating_6400.png]]&lt;br /&gt;
&lt;br /&gt;
9) After impersonation, ''Instructor4'' will be able to see only his/her assignment details and not of any other instructors.&lt;br /&gt;
[[File: Ins4_display_res_after_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
10) Login as ''TeachingAssistant1274'' who is a TA for the Course 517, Spring 2016, who is a TA under Instructor6.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
11) Create an assignment ''TA_Assignment'' and make ''student6400'' as a participant.&lt;br /&gt;
[[File: Ta_homepage.png]]&lt;br /&gt;
&lt;br /&gt;
12) Click on Manage-&amp;gt;Impersonate user and enter ''student6400'' as the student to be impersonated.&lt;br /&gt;
[[File: TA_enters_student_impersonate.png]]&lt;br /&gt;
&lt;br /&gt;
13) After impersonation, ''TeachingAssistant1274'' will be able to see all the assignment details of all courses for which (s)he is the TA and not the details of the other assignments.&lt;br /&gt;
[[File: TA_impersonate_res.png]]&lt;br /&gt;
&lt;br /&gt;
14) This verifies that the bugs have been fixed.&lt;br /&gt;
&lt;br /&gt;
==='''Issue #1185'''===&lt;br /&gt;
&lt;br /&gt;
1) Login as an ''Instructor'' or ''Admin'' or ''Super-Admin'' or ''TA''. &lt;br /&gt;
&lt;br /&gt;
2) Click on Manage -&amp;gt; Assignments. In the ''Actions'' column click on ''Add Participant''.&lt;br /&gt;
&lt;br /&gt;
3) After the list of all the participants you will be able to see ''Enter a user login'' text box.&lt;br /&gt;
&lt;br /&gt;
4) Enter the user login in the text box (Ex: student9000) and click on ''Add'' button.&lt;br /&gt;
&lt;br /&gt;
5) After clicking on the ''Add'' button, you will see the participant added at end of the list.&lt;br /&gt;
&lt;br /&gt;
6) This verifies the bug has been fixed.&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TA_impersonate_res.png&amp;diff=118624</id>
		<title>File:TA impersonate res.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TA_impersonate_res.png&amp;diff=118624"/>
		<updated>2018-11-03T06:53:25Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:TA_enters_student_impersonate.png&amp;diff=118623</id>
		<title>File:TA enters student impersonate.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:TA_enters_student_impersonate.png&amp;diff=118623"/>
		<updated>2018-11-03T06:52:26Z</updated>

		<summary type="html">&lt;p&gt;Ckaidab: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ckaidab</name></author>
	</entry>
</feed>