<?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=Sjrathi</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=Sjrathi"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sjrathi"/>
	<updated>2026-05-14T11:39:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Pie_chart.png&amp;diff=130680</id>
		<title>File:Pie chart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Pie_chart.png&amp;diff=130680"/>
		<updated>2019-12-07T01:38:51Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Pie chart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Pie Chart that the instructor views.&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=130659</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=130659"/>
		<updated>2019-12-07T01:31:01Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Our Work  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy:''' In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png | center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
1. Created a controller to handle the start/end times of the files viewed by the user. =&amp;gt; '''controllers/submission_viewing_events_controller.rb'''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Created a table in database to log start and end time for each link/file. It's schema is described below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Schema for table submission_viewing_events&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Null&lt;br /&gt;
! Key&lt;br /&gt;
|-&lt;br /&gt;
| id&lt;br /&gt;
| int(11)&lt;br /&gt;
| NO&lt;br /&gt;
| Primary Key&lt;br /&gt;
|-&lt;br /&gt;
| map_id&lt;br /&gt;
| int(11)&lt;br /&gt;
| YES&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| round&lt;br /&gt;
| int(11)&lt;br /&gt;
| YES&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| link&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| YES&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| start_at&lt;br /&gt;
| datetime&lt;br /&gt;
| YES&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| end_at&lt;br /&gt;
| datetime&lt;br /&gt;
| YES&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| created_at&lt;br /&gt;
| datetime&lt;br /&gt;
| NO&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| updated_at&lt;br /&gt;
| datetime&lt;br /&gt;
| NO&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
3. Added view that will display with pie chart when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Pie chart.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Files that have been Added or Changed ''' ===&lt;br /&gt;
'''submission_viewing_events_controller.rb&amp;lt;br&amp;gt;'''&lt;br /&gt;
The &amp;lt;tt&amp;gt;record_start_time&amp;lt;/tt&amp;gt; function starts the time for links that have been visited by the user. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def record_start_time&lt;br /&gt;
  param_args = params[:submission_viewing_event]&lt;br /&gt;
  # check if this link is already opened and timed&lt;br /&gt;
  submission_viewing_event_records = SubmissionViewingEvent.where(map_id: param_args[:map_id], round: param_args[:round], link: param_args[:link])&lt;br /&gt;
  # if opened, end these records with current time&lt;br /&gt;
  if submission_viewing_event_records&lt;br /&gt;
    submission_viewing_event_records.each do |time_record|&lt;br /&gt;
	  if time_record.end_at.nil?&lt;br /&gt;
	    # time_record.update_attribute('end_at', start_at)&lt;br /&gt;
	    time_record.destroy&lt;br /&gt;
	  end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  # create new response time record for current link&lt;br /&gt;
  submission_viewing_event = SubmissionViewingEvent.new(submission_viewing_event_params)&lt;br /&gt;
  submission_viewing_event.save&lt;br /&gt;
&lt;br /&gt;
  #if creating start time for expertiza update end times for all other links.&lt;br /&gt;
  if param_args[:link]=='Expertiza Review' &lt;br /&gt;
    params[:submission_viewing_event][:link] = nil&lt;br /&gt;
    params[:submission_viewing_event][:end_at] = params[:submission_viewing_event][:start_at]&lt;br /&gt;
    record_end_time()&lt;br /&gt;
  end&lt;br /&gt;
  render nothing: true&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;The &amp;lt;tt&amp;gt;record_end_time&amp;lt;/tt&amp;gt; function records the end time for links that have been visited by the user. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def record_end_time&lt;br /&gt;
  data = params.require(:submission_viewing_event)&lt;br /&gt;
  if data[:link].nil?&lt;br /&gt;
    submission_viewing_event_records = SubmissionViewingEvent.where(map_id: data[:map_id], round: data[:round], end_at: nil).where.not(link: &amp;quot;Expertiza Review&amp;quot;)&lt;br /&gt;
  else&lt;br /&gt;
    submission_viewing_event_records = SubmissionViewingEvent.where(map_id: data[:map_id], round: data[:round], link: data[:link])&lt;br /&gt;
  end&lt;br /&gt;
  submission_viewing_event_records.each do |time_record|&lt;br /&gt;
    if time_record.end_at.nil?&lt;br /&gt;
	time_record.update_attribute('end_at', data[:end_at])&lt;br /&gt;
	# break&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  respond_to do |format|&lt;br /&gt;
    format.json { head :no_content }&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;The &amp;lt;tt&amp;gt;mark_end_time&amp;lt;/tt&amp;gt; function records the end time for links that have no end times.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def mark_end_time&lt;br /&gt;
  data = params.require(:submission_viewing_event)&lt;br /&gt;
  @link_array = []&lt;br /&gt;
  submission_viewing_event_records = SubmissionViewingEvent.where(map_id: data[:map_id], round: data[:round])&lt;br /&gt;
  submission_viewing_event_records.each do |submissionviewingevent_entry|&lt;br /&gt;
    if submissionviewingevent_entry.end_at.nil?&lt;br /&gt;
	@link_array.push(submissionviewingevent_entry.link)&lt;br /&gt;
	submissionviewingevent_entry.update_attribute('end_at', data[:end_at])&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
  respond_to do |format|&lt;br /&gt;
    format.json { render json: @link_array }&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;
reviewer_details_popup.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
_review_report.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
_review_submissions_time_spent.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
response_times.coffee&amp;lt;br&amp;gt;&lt;br /&gt;
response_times.scss&amp;lt;br&amp;gt;&lt;br /&gt;
response_controller.rb&amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb&amp;lt;br&amp;gt;&lt;br /&gt;
responses_times_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
response_time.rb&amp;lt;br&amp;gt;&lt;br /&gt;
_submitted_files.html.erb&lt;br /&gt;
&lt;br /&gt;
=== ''' Algorithm For Precise Timing Accuracy ''' ===&lt;br /&gt;
Previous implementations attempted to record the time users spent viewing each link, but their solution has multiple problems. The primary problem was that when multiple links were open at the same time (thus overlapping with one another) the times at which they overlap are recorded twice. To fix this, we implemented the following algorithm within \app\views\reports\_review_submissions_time_spent.html.erb:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Consider that each link duration (the amount of time that link is being looked at) has a starting and ending edge (see diagram below). These durations are stored in an array durations_to_consider.&lt;br /&gt;
&lt;br /&gt;
Iterate through every link duration in durations_to_consider:&lt;br /&gt;
    If any other link's start and end times both fit within our start and end time:&lt;br /&gt;
        Remove from durations_to_consider&lt;br /&gt;
&lt;br /&gt;
For list of durations_to_consider, add those durations' start and end edges to edge_array.&lt;br /&gt;
&lt;br /&gt;
Ensure that entries in edge_array are sorted from earliest to latest.&lt;br /&gt;
&lt;br /&gt;
Create list duration_sections.&lt;br /&gt;
&lt;br /&gt;
Start at the first edge in edge_array. Go until next edge. Record the time difference as a duration and add time to duration_sections.&lt;br /&gt;
&lt;br /&gt;
    If, after we add an edge that corresponds to the ending edge of a link duration, there are no open start edges (a start edge that belongs to a link, that does not yet have an accompanying end edge that belongs to that link): &lt;br /&gt;
        Count the NEXT start edge as the start edge of the next duration section. This will prevent empty space caused by no link being open at that time from being counted towards the total.&lt;br /&gt;
&lt;br /&gt;
Total up the time for all durations to get the total amount of time spent on links.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' The following diagrams are simply meant to help explain the timing algorithm. They are not indicative of the real system. For example, there will never be a time when an Expertiza duration overlaps with a link duration.&lt;br /&gt;
&lt;br /&gt;
The following diagram shows an example of what links could look like prior to our algorithm running:&lt;br /&gt;
[[File:Final_documentation_before_algorithm.PNG | center]]&lt;br /&gt;
&lt;br /&gt;
After our algorithm runs, one can see that the overlapping segments are eliminated. For convenience, each duration_section is highlighted:&lt;br /&gt;
[[File:Final_documentation_after_algorithm.PNG | center]]&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
We have made changes to the controllers/submission_viewing_events_controller.rb and added test cases for the same, which have passed all the test cases. The tests can be executed &amp;lt;tt&amp;gt;rpec spec&amp;lt;/tt&amp;gt; and the results for the files we have modified are shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Randomized with seed 20933&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
Finished in 10.31 seconds (files took 7.85 seconds to load)&lt;br /&gt;
5 examples, 0 failures&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http://152.46.18.99:8080/ Deployed Link]&lt;br /&gt;
*[http://www.youtube.com/ YouTube Video] (To be updated.)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Issues found and fixes ''' ==&lt;br /&gt;
#If a student only saves the review and does not submit it before the due date, the response exists but the entry is not updated as submitted. Because of this the response entry is not updated with the end time and hence when we try to calculate the total response object time, it calculates that as zero and hence shows &amp;quot;Review hasn't been submitted&amp;quot;. The response table should be updated once it's past due date. This was out of scope for this project hence we leave it as future fix.&lt;br /&gt;
#The &amp;quot;Save review after every 60 seconds&amp;quot; checkbox does not work correctly, hence we defaulted that to unchecked as opposed to previous implementation where it was checked, because it hampers with our implementation. This is another fix required.&lt;br /&gt;
#The submission_viewing_event table increases in size very rapidly as it stores start and end times for each link if a particular event occurs. Solution to that would be to save all the entries locally in users system and update the database only with expertiza time and link time after performing the time calculation, once the user clicks Save/Submit. This would prevent the database from saving unnecessary amount of information and also make it work faster.&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129499</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129499"/>
		<updated>2019-11-16T04:48:51Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Files that will be Added or Changed  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy:''' In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png | center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1791db.jpg | center]]&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ''' Files that will be Added or Changed ''' ===&lt;br /&gt;
d3.js&amp;lt;br&amp;gt;&lt;br /&gt;
d3pie.min.js&amp;lt;br&amp;gt;&lt;br /&gt;
response_times.coffee&amp;lt;br&amp;gt;&lt;br /&gt;
response_times.scss&amp;lt;br&amp;gt;&lt;br /&gt;
response_controller.rb&amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb&amp;lt;br&amp;gt;&lt;br /&gt;
responses_times_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping_helper.rb&amp;lt;br&amp;gt;&lt;br /&gt;
response_time.rb&amp;lt;br&amp;gt;&lt;br /&gt;
reviewer_details_popup.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
_review_report.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
_review_submissions_time_spent.html.erb&amp;lt;br&amp;gt;&lt;br /&gt;
_submitted_files.html.erb&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129321</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129321"/>
		<updated>2019-11-14T01:36:19Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy:''' In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png | center]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1791db.jpg | center]]&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129320</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129320"/>
		<updated>2019-11-14T01:35:43Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Anticipated Code Changes  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy:''' In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1791db.jpg | center]]&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129319</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129319"/>
		<updated>2019-11-14T01:35:28Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Anticipated Code Changes  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy:''' In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1791db.jpg | center]]&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129294</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129294"/>
		<updated>2019-11-13T04:17:47Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* Design pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy:''' In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129293</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129293"/>
		<updated>2019-11-13T04:17:33Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Proposed Solution  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
'''Strategy''' :In this project, for each review page, we need to deal with different type of links. For online links, such as github repo, youtube link, etc, we use javascript to open a new window detect time when the window is closed. For submitted files, such as txt, jpg, we will open it with  views/response/_submitted_files.html.erb. For other files that need to be download and open locally, we can only make approximation for review time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129291</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129291"/>
		<updated>2019-11-13T03:04:09Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129290</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129290"/>
		<updated>2019-11-13T03:03:08Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
Every time a start time is logged for expertiza/link/file, a new entry will be created in the database.End time will be updated on the last entry present for the same link/file.&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
Time for individual links will summed and then displayed as bar graph.&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129289</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129289"/>
		<updated>2019-11-13T02:26:14Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129288</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129288"/>
		<updated>2019-11-13T02:25:54Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129287</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129287"/>
		<updated>2019-11-13T02:25:11Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Code Changes  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Anticipated Code Changes ''' ==&lt;br /&gt;
1. Create a controller to handle the pop ups that will be displayed.&amp;lt;br&amp;gt;&lt;br /&gt;
2. Create a model to log start and end time for each link/file.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Add view that will be displayed with bar graph when instructor wants to see time spent on individual links/files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129276</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129276"/>
		<updated>2019-11-12T18:26:46Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Problem Statement  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129275</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=129275"/>
		<updated>2019-11-12T18:26:37Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Introduction  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128566</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128566"/>
		<updated>2019-11-11T09:08:51Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128565</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128565"/>
		<updated>2019-11-11T09:07:09Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128564</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128564"/>
		<updated>2019-11-11T09:06:34Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png|thumb]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png|frame]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Instructor_flowchart.png&amp;diff=128563</id>
		<title>File:E1989 Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Instructor_flowchart.png&amp;diff=128563"/>
		<updated>2019-11-11T09:05:48Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:E1989 Instructor flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128562</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128562"/>
		<updated>2019-11-11T09:03:39Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128561</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128561"/>
		<updated>2019-11-11T09:03:00Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png|200px]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Student_flowchart.png&amp;diff=128560</id>
		<title>File:E1989 Student flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Student_flowchart.png&amp;diff=128560"/>
		<updated>2019-11-11T08:59:45Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:E1989 Student flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Instructor_flowchart.png&amp;diff=128559</id>
		<title>File:E1989 Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Instructor_flowchart.png&amp;diff=128559"/>
		<updated>2019-11-11T08:59:07Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:E1989 Instructor flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128537</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128537"/>
		<updated>2019-11-11T06:06:28Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Proposed Solution  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
&amp;lt;b&amp;gt;Instructor&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Instructor_flowchart.png]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Reviewer&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:E1989_Student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Student_flowchart.png&amp;diff=128536</id>
		<title>File:E1989 Student flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Student_flowchart.png&amp;diff=128536"/>
		<updated>2019-11-11T06:03:02Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Instructor_flowchart.png&amp;diff=128535</id>
		<title>File:E1989 Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E1989_Instructor_flowchart.png&amp;diff=128535"/>
		<updated>2019-11-11T06:02:30Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128534</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128534"/>
		<updated>2019-11-11T06:01:40Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Proposed Solution  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128533</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128533"/>
		<updated>2019-11-11T05:59:17Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flow.png]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flow.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor.png&amp;diff=128532</id>
		<title>File:Instructor.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor.png&amp;diff=128532"/>
		<updated>2019-11-11T05:58:55Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Instructor.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128531</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128531"/>
		<updated>2019-11-11T05:57:02Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor.png]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128530</id>
		<title>File:Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128530"/>
		<updated>2019-11-11T05:54:03Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Instructor flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128529</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128529"/>
		<updated>2019-11-11T05:53:13Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flowchart.png | 200px|thumb|left|Instructor]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flowchart.png|Reviewer]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128528</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128528"/>
		<updated>2019-11-11T05:52:42Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flowchart.png | 200px|thumb|left|alt text]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128527</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128527"/>
		<updated>2019-11-11T05:50:07Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flowchart.png200px|thumb|left|alt text]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128526</id>
		<title>File:Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128526"/>
		<updated>2019-11-11T05:48:54Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Instructor flowchart.png&amp;amp;quot;: Reverted to version as of 22:55, 10 November 2019&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128525</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128525"/>
		<updated>2019-11-11T05:48:33Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flowchart.png]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128524</id>
		<title>File:Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128524"/>
		<updated>2019-11-11T05:48:05Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Instructor flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_flowchart.png&amp;diff=128523</id>
		<title>File:Student flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_flowchart.png&amp;diff=128523"/>
		<updated>2019-11-11T05:47:16Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128522</id>
		<title>File:Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128522"/>
		<updated>2019-11-11T05:46:50Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Instructor flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128521</id>
		<title>File:Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128521"/>
		<updated>2019-11-11T05:46:19Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: uploaded a new version of &amp;amp;quot;File:Instructor flowchart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128520</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128520"/>
		<updated>2019-11-11T05:45:58Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor-flowchart.png]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128242</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128242"/>
		<updated>2019-11-10T22:56:50Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  User Flowchart  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flowchart.png]]&lt;br /&gt;
Reviewer&lt;br /&gt;
[[File:student_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128241</id>
		<title>File:Instructor flowchart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructor_flowchart.png&amp;diff=128241"/>
		<updated>2019-11-10T22:55:28Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128240</id>
		<title>CSC/ECE 517 Fall 2019 - E1989. Track the time students look at other submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_E1989._Track_the_time_students_look_at_other_submissions&amp;diff=128240"/>
		<updated>2019-11-10T22:54:57Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /*  Proposed Solution  */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== ''' Introduction ''' ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project takes advantage of peer-review among students to allow them to learn from each other. Tracking the time that a student spends on each submitted resources is meaningful to instructors to study and improve the teaching experience. Unfortunately, most peer assessment systems do not manage the content of students’ submission within the systems. They usually allow the authors submit external links to the submission (e.g. GitHub code / deployed application), which makes it difficult for the system to track the time that the reviewers spend on the submissions.&lt;br /&gt;
&lt;br /&gt;
=== Current Implementation ===&lt;br /&gt;
So far, Expertiza does not have any such feature. However, three teams have already worked on this in the past but their builds were not merged due to some problems.&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/875 E1705] identified how to track the active time of windows opened from the submitted links. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2016/E1705._Tracking_the_time_students_look_at_the_others%27_submissions Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1124 E1791] provided detailed insights on how they planned to track time taken by a student in viewing a submission and possible edge cases. Further, they also implemented popups and figured out a way to open downloadable files. However, the details are rendered in a not-so-friendly manner and hence it was not merged. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement Wiki])&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1309 E1872] tried to solve this by incorporating the statistics in the review reports page, but their UI made the page cluttered and not friendly. Further, it was hard to identify which statistic belonged to which review, and there were almost no tests. ([http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2018/E1872_Track_Time_Students_Look_At_Other_Submissions Wiki])&lt;br /&gt;
&lt;br /&gt;
== ''' Problem Statement ''' ==&lt;br /&gt;
Knowing how much time a student spends on a review is helpful when determining the quality of the review itself. That being said Expertiza needs to be able to '''track''' and '''display''' how much time a student spends on each review. &lt;br /&gt;
&lt;br /&gt;
The time spent on a review is the sum of multiple sources:&lt;br /&gt;
&lt;br /&gt;
# The time spent on the Expertiza assignment review page itself&lt;br /&gt;
# The time spent looking at external pages linked from the review page&lt;br /&gt;
# The time spent looking at downloadable files submitted by other students&lt;br /&gt;
&lt;br /&gt;
The purpose of this project three-fold:&lt;br /&gt;
&lt;br /&gt;
# Gather the timing data from the sources above.&lt;br /&gt;
# Display the data on the &amp;quot;Review Report&amp;quot; page (views/review_mapping/_review_report.html.erb) to show the time the student spent per review. Given that previous attempts have been rejected due to UI issues, it is important that this data is displayed cleanly.&lt;br /&gt;
# Write tests that confirm that the above goals are functioning correctly.&lt;br /&gt;
&lt;br /&gt;
== ''' Proposed Solution ''' ==&lt;br /&gt;
After investigating the prior attempts at this task, we have decided it would be best to begin our project by building off of the work done in project [https://github.com/expertiza/expertiza/pull/1124 E1791]. The reason for choosing to build off of this particular project is because they have already put the work into tracking time spent viewing external pages as well as time spent viewing certain types of downloadable files. In order to achieve our goals outlined in the [[#Problem Statement|Problem Statement]] section, the following changes need to be made:&lt;br /&gt;
&lt;br /&gt;
; The time spent on the Expertiza assignment review page needs to be tracked. &lt;br /&gt;
*This will be done by using onFocus and onBlur mouse events to tell when a user is actively working on the page.&lt;br /&gt;
*To prevent the user from cheating the system by just keeping the review page open without doing work, a timeout feature will be implemented. After 5 minutes of mouse/keyboard inactivity, a popup will be displayed asking if the user is still working. At that point, the time contributed towards the total by the Expertiza page will stop being tracked until the user interacts with the popup to indicate they are still working. This is already implemented in project [https://github.com/expertiza/expertiza/pull/1124 E1791].&lt;br /&gt;
&lt;br /&gt;
; The time spent viewing the external links and downloadable files will need to be made more accurate.&lt;br /&gt;
*Currently, if a student has an external link open as well as the Expertiza page, time is being tracked for both. Changes need to be made so that when the student is working on the Expertiza assignment review page time is not tracked for the external links or downloadable files.&lt;br /&gt;
&lt;br /&gt;
; The overall time spent on the review needs to be displayed in a table on the &amp;quot;Review Report&amp;quot; page.&lt;br /&gt;
*The table will look like the following table, but with one modification. The entries in &amp;quot;Time per review in mins&amp;quot; will be clickable. When clicked, they will display a popup that contains detailed information on where the time for the review was spent. For example, if a student spent a total of 22 minutes on the review, it will show that the student spent 5 minutes on the Expertiza review page, 10 minutes looking at external links, and 7 minutes looking at downloadable files. It will display these details in text format as well as graphically using a bar graph. The purpose of choosing this design is two-fold: &lt;br /&gt;
# It will not require the instructor to have to go to a different page every time they want more details on a particular review. Given that the review report page takes a substantial time to load, this is a necessity.&lt;br /&gt;
# It will prevent the table on the review report page from being cluttered by figures and too much data.&lt;br /&gt;
&lt;br /&gt;
[[File:Review report view.png]]&lt;br /&gt;
&lt;br /&gt;
=== ''' User Flowchart ''' ===&lt;br /&gt;
Instructor&lt;br /&gt;
[[File:instructor_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
== ''' Code Changes ''' ==&lt;br /&gt;
''No code changes yet.''&lt;br /&gt;
&lt;br /&gt;
==  ''' Test Plan ''' ==&lt;br /&gt;
For our project, there are a few distinct tests &amp;quot;suites&amp;quot; that need to be written.&lt;br /&gt;
# We need to write tests that automatically verify the validity of the previous team's solution.&lt;br /&gt;
# We need to write tests that verify that the information is being displayed correctly to the user.&lt;br /&gt;
# We need to write tests to verify that our onFocus/onBlur code is functioning as intended.&lt;br /&gt;
# We need to write tests that verify the pop-up is working correctly.&lt;br /&gt;
&lt;br /&gt;
=== Automated Testing Using RSpec ===&lt;br /&gt;
In order to implement the aforementioned necessities, we'll be writing automated tests in RSpec to achieve this.&lt;br /&gt;
&lt;br /&gt;
=== Coverage ===&lt;br /&gt;
In theory, the coverage of our overall project should increase significantly as we'll be adding tests that account for nearly a thousand lines of new code.&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
We hope to not need any manual UI testing, though if it is needed, it'll look something like this:&lt;br /&gt;
&lt;br /&gt;
Verifying Time is Tracked Correctly:&lt;br /&gt;
# Sign in as as a student&lt;br /&gt;
# Review an assignment&lt;br /&gt;
# Go through the review as normal&lt;br /&gt;
## Make sure you open links to github or pull requests&lt;br /&gt;
## Make sure you download and/or view files that are attatched&lt;br /&gt;
# Submit your review when you're done&lt;br /&gt;
# Log out as a student&lt;br /&gt;
# Log in as an instructor&lt;br /&gt;
# Navigate to the review report tab&lt;br /&gt;
# You should see a new column detailing the time the user spent on the review.&lt;br /&gt;
&lt;br /&gt;
== ''' Our Work ''' ==&lt;br /&gt;
The code we created can be found below.&lt;br /&gt;
*[https://github.com/rohanpillai20/expertiza GitHub Repository]&lt;br /&gt;
*[https://github.com/expertiza/expertiza/pull/1607 Pull Request]&lt;br /&gt;
*[http:// Deployed URL] (Currently, Does not Exist)&lt;br /&gt;
&lt;br /&gt;
The project could be run locally by cloning the [https://github.com/rohanpillai20/expertiza GitHub Repository] and then running the following commands sequentially.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
bundle install&lt;br /&gt;
rake db:create:all&lt;br /&gt;
rake db:migrate&lt;br /&gt;
rails s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ''' Team Information ''' ==&lt;br /&gt;
#Dylan Spruill (drspruil)&lt;br /&gt;
#Forrest Devita (fcdevita)&lt;br /&gt;
#Rohan Pillai (rspillai)&lt;br /&gt;
#Shalin Rathi (sjrathi)&lt;br /&gt;
&lt;br /&gt;
Mentor: Akanksha Mohan (amohan7)&lt;br /&gt;
&amp;lt;br&amp;gt;Professor: Dr. Edward F. Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://relishapp.com/rspec RSpec Documentation]&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126648</id>
		<title>CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126648"/>
		<updated>2019-10-29T05:51:50Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* Project Mentors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1947. Refactoring quiz_questionnaire_controller.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Rename filename such that it follows the coding standards&lt;br /&gt;
* Remove redundant information from method names&lt;br /&gt;
* Add comments to methods and complex lines of code&lt;br /&gt;
* Remove unsafe reflection method&lt;br /&gt;
* Simplify RSpec&lt;br /&gt;
* Try to fix issues from Code Climate&lt;br /&gt;
&lt;br /&gt;
===About Quiz Questionnaire Controller===&lt;br /&gt;
This is a new controller, having recently been separated from questionnaires_controller.rb.  It is used to allow students to take quizzes.  The idea is that the author(s) of submitted work can write a quiz that is given to each reviewer before the reviewer is allowed to review the work.  If the reviewer does badly on the quiz, then we know not to trust the review. It is also possible to set up an Expertiza assignment so that some participants just take the quiz and don’t review the work.&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Functionality=====&lt;br /&gt;
* A student can create a quiz questionnaire for the assignments that allow a quiz to be generated. This quiz will be taken by the reviewers, once they are done reviewing the development/project. Based on their answers the TA's can know whether to consider the reviewer's review or not based , because if the reviewer didn't perform well on the quiz, then it is likely that the review is not done properly. &lt;br /&gt;
&lt;br /&gt;
* The maximum number of questions is decided by the instructor when creating the assignment. &lt;br /&gt;
&lt;br /&gt;
* The student has option to either create True/False, Multiple-Choice Checkbox or Multiple-Choice Radio question. &lt;br /&gt;
&lt;br /&gt;
* The question cannot be blank and correct answer must be selected to create a quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Drawbacks and Solutions=====&lt;br /&gt;
* '''Problem 1''':Rename filename such that it follows the coding standards&lt;br /&gt;
'''Solution''':Currently the file was named as quiz_questionnaire_controller.rb. This doesn't follow the Ruby naming standards. Hence it was changed to quiz_questionnaires_controller.rb&lt;br /&gt;
* '''Problem 2''':Remove redundant information from method names&lt;br /&gt;
'''Solution''':Since this controller was separated from the questionnaires_controller.rb, the method names were kept the same from the previous controller which had redundant information.&lt;br /&gt;
Method names were renamed by removing the succeeding '_quiz'. Also valid_quiz was renamed to validate_quiz to make more sense. Also the routes.rb was changed to accept these changes.&lt;br /&gt;
* '''Problem 3''':Add comments to methods and complex lines of code&lt;br /&gt;
'''Solution''':Many methods had more than 325 lines of code and performed multiple functionalities. These methods were changed by creating private methods that performed individual tasks, thus reducing the lines of code and the complexity.&lt;br /&gt;
* '''Problem 4''':Remove unsafe reflection method&lt;br /&gt;
'''Solution''':This part was already implemented, hence no changes were made.&lt;br /&gt;
* '''Problem 5''':Try to fix issues from Code Climate&lt;br /&gt;
'''Solution''':Refer to Solution for Problem 3&lt;br /&gt;
&lt;br /&gt;
===Code improvements===&lt;br /&gt;
* The method '''save_choices''' had a congnitive complexity of 23 and had 37 lines of code. By refactoring, the number of lines was reduced to 20 and private methods '''create_checkbox''', '''create_truefalse''' and '''create_radio''' were implemented to break up functionality and to reduce cognitive complexity.&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      params[:new_choices][question_num.to_s][q_type].each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][choice_key][:iscorrect] == 1.to_s&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          else&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      q_choices = params[:new_choices][question_num.to_s][q_type]&lt;br /&gt;
      q_choices.each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          create_checkbox(question, choice_key, q_choices)&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          create_truefalse(question, choice_key, q_choices)&lt;br /&gt;
        else # MultipleChoiceRadio&lt;br /&gt;
          create_radio(question, choice_key, q_choices)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''action_allowed?''' has been implemented in quiz_questionnaire_controller.rb to specifically allow Student to edit an existing quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The quiz_questionnaire_controller_spec.rb has been updated to allow edit tests to work for Student role.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let(:student) { build(:student, id: 8609) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role) #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role)  #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''update_quiz''' has been renamed to '''update''' and has been refactored to reduce the line count by breaking functionalities. (The function '''multiple_choice_checkbox''' was renamed to '''update_checkbox''' and '''multiple_choice_radio''' was renamed to '''update_radio''' so as to reduce function name length and bring consistency with methods performing create operations: '''create_radio''', '''create_checkbox''', '''create_truefalse''')&lt;br /&gt;
The Cognitive Complexity of update method has now been reduced to 15 (from 29).&amp;lt;br&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          multiple_choice_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          multiple_choice_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
            if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
              # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
            else # the statement is not correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
              # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          update_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          update_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          update_truefalse(question_choice) if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update_truefalse(question_choice)&lt;br /&gt;
    if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
      # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
    else # the statement is not correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
      # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''valid_quiz''' has been renamed to '''validate_quiz'''. The function  '''validate_question''' was extracted out to only validate the particular question. The part where quiz name was being verified was also taken out of the loop to only verify this once as opposed to verifying in each iteration, which was unnecessary.  The Cognitive Complexity of 12 has now been reduced to less than 5. &lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def valid_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
        valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
      elsif !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
        # A type isnt selected for a question&lt;br /&gt;
        valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        @new_question = Object.const_get(params[:question_type][i.to_s][:type]).create(txt: '', type: params[:question_type][i.to_s][:type], break_before: true)&lt;br /&gt;
        @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
        type = params[:question_type][i.to_s][:type]&lt;br /&gt;
        choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
        valid = if choice_info.nil?&lt;br /&gt;
                  &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  @new_question.isvalid(choice_info)&lt;br /&gt;
                end&lt;br /&gt;
      end&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
    if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
      valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
      valid = validate_question(i)&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_question(i)&lt;br /&gt;
    if !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
      # A type isn't selected for a question&lt;br /&gt;
      valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # The question type is dynamic, so const_get is necessary&lt;br /&gt;
      type = params[:question_type][i.to_s][:type]&lt;br /&gt;
      @new_question = Object.const_get(type).create(txt: '', type: type, break_before: true)&lt;br /&gt;
      @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
      choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
      valid = if choice_info.nil?&lt;br /&gt;
                &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
              else&lt;br /&gt;
                @new_question.isvalid(choice_info)&lt;br /&gt;
              end&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Link to [https://youtu.be/dVu0-LZcW1w video] showing the RSpec testing.&lt;br /&gt;
====Automated Testing using RSPEC====&lt;br /&gt;
[[File:RspecResults.png]]&lt;br /&gt;
&lt;br /&gt;
====Testing from Travis CI====&lt;br /&gt;
[[File:TravisCIBuild.png]]&lt;br /&gt;
[[File:GitChecksPass.png]]&lt;br /&gt;
&lt;br /&gt;
==Project Mentors==&lt;br /&gt;
&lt;br /&gt;
#Edward Gehringer (efg@ncsu.edu)&lt;br /&gt;
#Akanksha Mohan (amohan7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
#Shalin Rathi (sjrathi@ncsu.edu)&lt;br /&gt;
#Akshay Saxena (asaxena5@ncsu.edu)&lt;br /&gt;
#Daniel Mendez (dmendez@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/shalinshal/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://youtu.be/dVu0-LZcW1w  Demo link] &lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126647</id>
		<title>CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126647"/>
		<updated>2019-10-29T05:51:34Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* Team Members */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1947. Refactoring quiz_questionnaire_controller.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Rename filename such that it follows the coding standards&lt;br /&gt;
* Remove redundant information from method names&lt;br /&gt;
* Add comments to methods and complex lines of code&lt;br /&gt;
* Remove unsafe reflection method&lt;br /&gt;
* Simplify RSpec&lt;br /&gt;
* Try to fix issues from Code Climate&lt;br /&gt;
&lt;br /&gt;
===About Quiz Questionnaire Controller===&lt;br /&gt;
This is a new controller, having recently been separated from questionnaires_controller.rb.  It is used to allow students to take quizzes.  The idea is that the author(s) of submitted work can write a quiz that is given to each reviewer before the reviewer is allowed to review the work.  If the reviewer does badly on the quiz, then we know not to trust the review. It is also possible to set up an Expertiza assignment so that some participants just take the quiz and don’t review the work.&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Functionality=====&lt;br /&gt;
* A student can create a quiz questionnaire for the assignments that allow a quiz to be generated. This quiz will be taken by the reviewers, once they are done reviewing the development/project. Based on their answers the TA's can know whether to consider the reviewer's review or not based , because if the reviewer didn't perform well on the quiz, then it is likely that the review is not done properly. &lt;br /&gt;
&lt;br /&gt;
* The maximum number of questions is decided by the instructor when creating the assignment. &lt;br /&gt;
&lt;br /&gt;
* The student has option to either create True/False, Multiple-Choice Checkbox or Multiple-Choice Radio question. &lt;br /&gt;
&lt;br /&gt;
* The question cannot be blank and correct answer must be selected to create a quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Drawbacks and Solutions=====&lt;br /&gt;
* '''Problem 1''':Rename filename such that it follows the coding standards&lt;br /&gt;
'''Solution''':Currently the file was named as quiz_questionnaire_controller.rb. This doesn't follow the Ruby naming standards. Hence it was changed to quiz_questionnaires_controller.rb&lt;br /&gt;
* '''Problem 2''':Remove redundant information from method names&lt;br /&gt;
'''Solution''':Since this controller was separated from the questionnaires_controller.rb, the method names were kept the same from the previous controller which had redundant information.&lt;br /&gt;
Method names were renamed by removing the succeeding '_quiz'. Also valid_quiz was renamed to validate_quiz to make more sense. Also the routes.rb was changed to accept these changes.&lt;br /&gt;
* '''Problem 3''':Add comments to methods and complex lines of code&lt;br /&gt;
'''Solution''':Many methods had more than 325 lines of code and performed multiple functionalities. These methods were changed by creating private methods that performed individual tasks, thus reducing the lines of code and the complexity.&lt;br /&gt;
* '''Problem 4''':Remove unsafe reflection method&lt;br /&gt;
'''Solution''':This part was already implemented, hence no changes were made.&lt;br /&gt;
* '''Problem 5''':Try to fix issues from Code Climate&lt;br /&gt;
'''Solution''':Refer to Solution for Problem 3&lt;br /&gt;
&lt;br /&gt;
===Code improvements===&lt;br /&gt;
* The method '''save_choices''' had a congnitive complexity of 23 and had 37 lines of code. By refactoring, the number of lines was reduced to 20 and private methods '''create_checkbox''', '''create_truefalse''' and '''create_radio''' were implemented to break up functionality and to reduce cognitive complexity.&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      params[:new_choices][question_num.to_s][q_type].each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][choice_key][:iscorrect] == 1.to_s&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          else&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      q_choices = params[:new_choices][question_num.to_s][q_type]&lt;br /&gt;
      q_choices.each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          create_checkbox(question, choice_key, q_choices)&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          create_truefalse(question, choice_key, q_choices)&lt;br /&gt;
        else # MultipleChoiceRadio&lt;br /&gt;
          create_radio(question, choice_key, q_choices)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''action_allowed?''' has been implemented in quiz_questionnaire_controller.rb to specifically allow Student to edit an existing quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The quiz_questionnaire_controller_spec.rb has been updated to allow edit tests to work for Student role.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let(:student) { build(:student, id: 8609) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role) #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role)  #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''update_quiz''' has been renamed to '''update''' and has been refactored to reduce the line count by breaking functionalities. (The function '''multiple_choice_checkbox''' was renamed to '''update_checkbox''' and '''multiple_choice_radio''' was renamed to '''update_radio''' so as to reduce function name length and bring consistency with methods performing create operations: '''create_radio''', '''create_checkbox''', '''create_truefalse''')&lt;br /&gt;
The Cognitive Complexity of update method has now been reduced to 15 (from 29).&amp;lt;br&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          multiple_choice_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          multiple_choice_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
            if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
              # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
            else # the statement is not correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
              # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          update_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          update_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          update_truefalse(question_choice) if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update_truefalse(question_choice)&lt;br /&gt;
    if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
      # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
    else # the statement is not correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
      # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''valid_quiz''' has been renamed to '''validate_quiz'''. The function  '''validate_question''' was extracted out to only validate the particular question. The part where quiz name was being verified was also taken out of the loop to only verify this once as opposed to verifying in each iteration, which was unnecessary.  The Cognitive Complexity of 12 has now been reduced to less than 5. &lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def valid_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
        valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
      elsif !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
        # A type isnt selected for a question&lt;br /&gt;
        valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        @new_question = Object.const_get(params[:question_type][i.to_s][:type]).create(txt: '', type: params[:question_type][i.to_s][:type], break_before: true)&lt;br /&gt;
        @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
        type = params[:question_type][i.to_s][:type]&lt;br /&gt;
        choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
        valid = if choice_info.nil?&lt;br /&gt;
                  &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  @new_question.isvalid(choice_info)&lt;br /&gt;
                end&lt;br /&gt;
      end&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
    if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
      valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
      valid = validate_question(i)&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_question(i)&lt;br /&gt;
    if !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
      # A type isn't selected for a question&lt;br /&gt;
      valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # The question type is dynamic, so const_get is necessary&lt;br /&gt;
      type = params[:question_type][i.to_s][:type]&lt;br /&gt;
      @new_question = Object.const_get(type).create(txt: '', type: type, break_before: true)&lt;br /&gt;
      @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
      choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
      valid = if choice_info.nil?&lt;br /&gt;
                &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
              else&lt;br /&gt;
                @new_question.isvalid(choice_info)&lt;br /&gt;
              end&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Link to [https://youtu.be/dVu0-LZcW1w video] showing the RSpec testing.&lt;br /&gt;
====Automated Testing using RSPEC====&lt;br /&gt;
[[File:RspecResults.png]]&lt;br /&gt;
&lt;br /&gt;
====Testing from Travis CI====&lt;br /&gt;
[[File:TravisCIBuild.png]]&lt;br /&gt;
[[File:GitChecksPass.png]]&lt;br /&gt;
&lt;br /&gt;
==Project Mentors==&lt;br /&gt;
&lt;br /&gt;
Edward Gehringer (efg@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akansha Mohan (amohan7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
#Shalin Rathi (sjrathi@ncsu.edu)&lt;br /&gt;
#Akshay Saxena (asaxena5@ncsu.edu)&lt;br /&gt;
#Daniel Mendez (dmendez@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/shalinshal/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://youtu.be/dVu0-LZcW1w  Demo link] &lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126646</id>
		<title>CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126646"/>
		<updated>2019-10-29T05:51:23Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* Team Members */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1947. Refactoring quiz_questionnaire_controller.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Rename filename such that it follows the coding standards&lt;br /&gt;
* Remove redundant information from method names&lt;br /&gt;
* Add comments to methods and complex lines of code&lt;br /&gt;
* Remove unsafe reflection method&lt;br /&gt;
* Simplify RSpec&lt;br /&gt;
* Try to fix issues from Code Climate&lt;br /&gt;
&lt;br /&gt;
===About Quiz Questionnaire Controller===&lt;br /&gt;
This is a new controller, having recently been separated from questionnaires_controller.rb.  It is used to allow students to take quizzes.  The idea is that the author(s) of submitted work can write a quiz that is given to each reviewer before the reviewer is allowed to review the work.  If the reviewer does badly on the quiz, then we know not to trust the review. It is also possible to set up an Expertiza assignment so that some participants just take the quiz and don’t review the work.&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Functionality=====&lt;br /&gt;
* A student can create a quiz questionnaire for the assignments that allow a quiz to be generated. This quiz will be taken by the reviewers, once they are done reviewing the development/project. Based on their answers the TA's can know whether to consider the reviewer's review or not based , because if the reviewer didn't perform well on the quiz, then it is likely that the review is not done properly. &lt;br /&gt;
&lt;br /&gt;
* The maximum number of questions is decided by the instructor when creating the assignment. &lt;br /&gt;
&lt;br /&gt;
* The student has option to either create True/False, Multiple-Choice Checkbox or Multiple-Choice Radio question. &lt;br /&gt;
&lt;br /&gt;
* The question cannot be blank and correct answer must be selected to create a quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Drawbacks and Solutions=====&lt;br /&gt;
* '''Problem 1''':Rename filename such that it follows the coding standards&lt;br /&gt;
'''Solution''':Currently the file was named as quiz_questionnaire_controller.rb. This doesn't follow the Ruby naming standards. Hence it was changed to quiz_questionnaires_controller.rb&lt;br /&gt;
* '''Problem 2''':Remove redundant information from method names&lt;br /&gt;
'''Solution''':Since this controller was separated from the questionnaires_controller.rb, the method names were kept the same from the previous controller which had redundant information.&lt;br /&gt;
Method names were renamed by removing the succeeding '_quiz'. Also valid_quiz was renamed to validate_quiz to make more sense. Also the routes.rb was changed to accept these changes.&lt;br /&gt;
* '''Problem 3''':Add comments to methods and complex lines of code&lt;br /&gt;
'''Solution''':Many methods had more than 325 lines of code and performed multiple functionalities. These methods were changed by creating private methods that performed individual tasks, thus reducing the lines of code and the complexity.&lt;br /&gt;
* '''Problem 4''':Remove unsafe reflection method&lt;br /&gt;
'''Solution''':This part was already implemented, hence no changes were made.&lt;br /&gt;
* '''Problem 5''':Try to fix issues from Code Climate&lt;br /&gt;
'''Solution''':Refer to Solution for Problem 3&lt;br /&gt;
&lt;br /&gt;
===Code improvements===&lt;br /&gt;
* The method '''save_choices''' had a congnitive complexity of 23 and had 37 lines of code. By refactoring, the number of lines was reduced to 20 and private methods '''create_checkbox''', '''create_truefalse''' and '''create_radio''' were implemented to break up functionality and to reduce cognitive complexity.&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      params[:new_choices][question_num.to_s][q_type].each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][choice_key][:iscorrect] == 1.to_s&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          else&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      q_choices = params[:new_choices][question_num.to_s][q_type]&lt;br /&gt;
      q_choices.each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          create_checkbox(question, choice_key, q_choices)&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          create_truefalse(question, choice_key, q_choices)&lt;br /&gt;
        else # MultipleChoiceRadio&lt;br /&gt;
          create_radio(question, choice_key, q_choices)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''action_allowed?''' has been implemented in quiz_questionnaire_controller.rb to specifically allow Student to edit an existing quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The quiz_questionnaire_controller_spec.rb has been updated to allow edit tests to work for Student role.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let(:student) { build(:student, id: 8609) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role) #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role)  #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''update_quiz''' has been renamed to '''update''' and has been refactored to reduce the line count by breaking functionalities. (The function '''multiple_choice_checkbox''' was renamed to '''update_checkbox''' and '''multiple_choice_radio''' was renamed to '''update_radio''' so as to reduce function name length and bring consistency with methods performing create operations: '''create_radio''', '''create_checkbox''', '''create_truefalse''')&lt;br /&gt;
The Cognitive Complexity of update method has now been reduced to 15 (from 29).&amp;lt;br&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          multiple_choice_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          multiple_choice_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
            if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
              # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
            else # the statement is not correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
              # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          update_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          update_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          update_truefalse(question_choice) if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update_truefalse(question_choice)&lt;br /&gt;
    if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
      # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
    else # the statement is not correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
      # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''valid_quiz''' has been renamed to '''validate_quiz'''. The function  '''validate_question''' was extracted out to only validate the particular question. The part where quiz name was being verified was also taken out of the loop to only verify this once as opposed to verifying in each iteration, which was unnecessary.  The Cognitive Complexity of 12 has now been reduced to less than 5. &lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def valid_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
        valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
      elsif !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
        # A type isnt selected for a question&lt;br /&gt;
        valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        @new_question = Object.const_get(params[:question_type][i.to_s][:type]).create(txt: '', type: params[:question_type][i.to_s][:type], break_before: true)&lt;br /&gt;
        @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
        type = params[:question_type][i.to_s][:type]&lt;br /&gt;
        choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
        valid = if choice_info.nil?&lt;br /&gt;
                  &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  @new_question.isvalid(choice_info)&lt;br /&gt;
                end&lt;br /&gt;
      end&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
    if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
      valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
      valid = validate_question(i)&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_question(i)&lt;br /&gt;
    if !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
      # A type isn't selected for a question&lt;br /&gt;
      valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # The question type is dynamic, so const_get is necessary&lt;br /&gt;
      type = params[:question_type][i.to_s][:type]&lt;br /&gt;
      @new_question = Object.const_get(type).create(txt: '', type: type, break_before: true)&lt;br /&gt;
      @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
      choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
      valid = if choice_info.nil?&lt;br /&gt;
                &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
              else&lt;br /&gt;
                @new_question.isvalid(choice_info)&lt;br /&gt;
              end&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Link to [https://youtu.be/dVu0-LZcW1w video] showing the RSpec testing.&lt;br /&gt;
====Automated Testing using RSPEC====&lt;br /&gt;
[[File:RspecResults.png]]&lt;br /&gt;
&lt;br /&gt;
====Testing from Travis CI====&lt;br /&gt;
[[File:TravisCIBuild.png]]&lt;br /&gt;
[[File:GitChecksPass.png]]&lt;br /&gt;
&lt;br /&gt;
==Project Mentors==&lt;br /&gt;
&lt;br /&gt;
Edward Gehringer (efg@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akansha Mohan (amohan7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
#Shalin Rathi (sjrathi@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
#Akshay Saxena (asaxena5@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
#Daniel Mendez (dmendez@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/shalinshal/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://youtu.be/dVu0-LZcW1w  Demo link] &lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126645</id>
		<title>CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126645"/>
		<updated>2019-10-29T05:51:01Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1947. Refactoring quiz_questionnaire_controller.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Rename filename such that it follows the coding standards&lt;br /&gt;
* Remove redundant information from method names&lt;br /&gt;
* Add comments to methods and complex lines of code&lt;br /&gt;
* Remove unsafe reflection method&lt;br /&gt;
* Simplify RSpec&lt;br /&gt;
* Try to fix issues from Code Climate&lt;br /&gt;
&lt;br /&gt;
===About Quiz Questionnaire Controller===&lt;br /&gt;
This is a new controller, having recently been separated from questionnaires_controller.rb.  It is used to allow students to take quizzes.  The idea is that the author(s) of submitted work can write a quiz that is given to each reviewer before the reviewer is allowed to review the work.  If the reviewer does badly on the quiz, then we know not to trust the review. It is also possible to set up an Expertiza assignment so that some participants just take the quiz and don’t review the work.&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Functionality=====&lt;br /&gt;
* A student can create a quiz questionnaire for the assignments that allow a quiz to be generated. This quiz will be taken by the reviewers, once they are done reviewing the development/project. Based on their answers the TA's can know whether to consider the reviewer's review or not based , because if the reviewer didn't perform well on the quiz, then it is likely that the review is not done properly. &lt;br /&gt;
&lt;br /&gt;
* The maximum number of questions is decided by the instructor when creating the assignment. &lt;br /&gt;
&lt;br /&gt;
* The student has option to either create True/False, Multiple-Choice Checkbox or Multiple-Choice Radio question. &lt;br /&gt;
&lt;br /&gt;
* The question cannot be blank and correct answer must be selected to create a quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Drawbacks and Solutions=====&lt;br /&gt;
* '''Problem 1''':Rename filename such that it follows the coding standards&lt;br /&gt;
'''Solution''':Currently the file was named as quiz_questionnaire_controller.rb. This doesn't follow the Ruby naming standards. Hence it was changed to quiz_questionnaires_controller.rb&lt;br /&gt;
* '''Problem 2''':Remove redundant information from method names&lt;br /&gt;
'''Solution''':Since this controller was separated from the questionnaires_controller.rb, the method names were kept the same from the previous controller which had redundant information.&lt;br /&gt;
Method names were renamed by removing the succeeding '_quiz'. Also valid_quiz was renamed to validate_quiz to make more sense. Also the routes.rb was changed to accept these changes.&lt;br /&gt;
* '''Problem 3''':Add comments to methods and complex lines of code&lt;br /&gt;
'''Solution''':Many methods had more than 325 lines of code and performed multiple functionalities. These methods were changed by creating private methods that performed individual tasks, thus reducing the lines of code and the complexity.&lt;br /&gt;
* '''Problem 4''':Remove unsafe reflection method&lt;br /&gt;
'''Solution''':This part was already implemented, hence no changes were made.&lt;br /&gt;
* '''Problem 5''':Try to fix issues from Code Climate&lt;br /&gt;
'''Solution''':Refer to Solution for Problem 3&lt;br /&gt;
&lt;br /&gt;
===Code improvements===&lt;br /&gt;
* The method '''save_choices''' had a congnitive complexity of 23 and had 37 lines of code. By refactoring, the number of lines was reduced to 20 and private methods '''create_checkbox''', '''create_truefalse''' and '''create_radio''' were implemented to break up functionality and to reduce cognitive complexity.&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      params[:new_choices][question_num.to_s][q_type].each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][choice_key][:iscorrect] == 1.to_s&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          else&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      q_choices = params[:new_choices][question_num.to_s][q_type]&lt;br /&gt;
      q_choices.each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          create_checkbox(question, choice_key, q_choices)&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          create_truefalse(question, choice_key, q_choices)&lt;br /&gt;
        else # MultipleChoiceRadio&lt;br /&gt;
          create_radio(question, choice_key, q_choices)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''action_allowed?''' has been implemented in quiz_questionnaire_controller.rb to specifically allow Student to edit an existing quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The quiz_questionnaire_controller_spec.rb has been updated to allow edit tests to work for Student role.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let(:student) { build(:student, id: 8609) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role) #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role)  #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''update_quiz''' has been renamed to '''update''' and has been refactored to reduce the line count by breaking functionalities. (The function '''multiple_choice_checkbox''' was renamed to '''update_checkbox''' and '''multiple_choice_radio''' was renamed to '''update_radio''' so as to reduce function name length and bring consistency with methods performing create operations: '''create_radio''', '''create_checkbox''', '''create_truefalse''')&lt;br /&gt;
The Cognitive Complexity of update method has now been reduced to 15 (from 29).&amp;lt;br&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          multiple_choice_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          multiple_choice_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
            if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
              # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
            else # the statement is not correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
              # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          update_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          update_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          update_truefalse(question_choice) if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update_truefalse(question_choice)&lt;br /&gt;
    if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
      # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
    else # the statement is not correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
      # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''valid_quiz''' has been renamed to '''validate_quiz'''. The function  '''validate_question''' was extracted out to only validate the particular question. The part where quiz name was being verified was also taken out of the loop to only verify this once as opposed to verifying in each iteration, which was unnecessary.  The Cognitive Complexity of 12 has now been reduced to less than 5. &lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def valid_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
        valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
      elsif !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
        # A type isnt selected for a question&lt;br /&gt;
        valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        @new_question = Object.const_get(params[:question_type][i.to_s][:type]).create(txt: '', type: params[:question_type][i.to_s][:type], break_before: true)&lt;br /&gt;
        @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
        type = params[:question_type][i.to_s][:type]&lt;br /&gt;
        choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
        valid = if choice_info.nil?&lt;br /&gt;
                  &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  @new_question.isvalid(choice_info)&lt;br /&gt;
                end&lt;br /&gt;
      end&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
    if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
      valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
      valid = validate_question(i)&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_question(i)&lt;br /&gt;
    if !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
      # A type isn't selected for a question&lt;br /&gt;
      valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # The question type is dynamic, so const_get is necessary&lt;br /&gt;
      type = params[:question_type][i.to_s][:type]&lt;br /&gt;
      @new_question = Object.const_get(type).create(txt: '', type: type, break_before: true)&lt;br /&gt;
      @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
      choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
      valid = if choice_info.nil?&lt;br /&gt;
                &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
              else&lt;br /&gt;
                @new_question.isvalid(choice_info)&lt;br /&gt;
              end&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Link to [https://youtu.be/dVu0-LZcW1w video] showing the RSpec testing.&lt;br /&gt;
====Automated Testing using RSPEC====&lt;br /&gt;
[[File:RspecResults.png]]&lt;br /&gt;
&lt;br /&gt;
====Testing from Travis CI====&lt;br /&gt;
[[File:TravisCIBuild.png]]&lt;br /&gt;
[[File:GitChecksPass.png]]&lt;br /&gt;
&lt;br /&gt;
==Project Mentors==&lt;br /&gt;
&lt;br /&gt;
Edward Gehringer (efg@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akansha Mohan (amohan7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Shalin Rathi (sjrathi@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akshay Saxena (asaxena5@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Daniel Mendez (dmendez@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/shalinshal/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://youtu.be/dVu0-LZcW1w  Demo link] &lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126644</id>
		<title>CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126644"/>
		<updated>2019-10-29T05:50:19Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1947. Refactoring quiz_questionnaire_controller.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Rename filename such that it follows the coding standards&lt;br /&gt;
* Remove redundant information from method names&lt;br /&gt;
* Add comments to methods and complex lines of code&lt;br /&gt;
* Remove unsafe reflection method&lt;br /&gt;
* Simplify RSpec&lt;br /&gt;
* Try to fix issues from Code Climate&lt;br /&gt;
&lt;br /&gt;
===About Quiz Questionnaire Controller===&lt;br /&gt;
This is a new controller, having recently been separated from questionnaires_controller.rb.  It is used to allow students to take quizzes.  The idea is that the author(s) of submitted work can write a quiz that is given to each reviewer before the reviewer is allowed to review the work.  If the reviewer does badly on the quiz, then we know not to trust the review. It is also possible to set up an Expertiza assignment so that some participants just take the quiz and don’t review the work.&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Functionality=====&lt;br /&gt;
* A student can create a quiz questionnaire for the assignments that allow a quiz to be generated. This quiz will be taken by the reviewers, once they are done reviewing the development/project. Based on their answers the TA's can know whether to consider the reviewer's review or not based , because if the reviewer didn't perform well on the quiz, then it is likely that the review is not done properly. &lt;br /&gt;
&lt;br /&gt;
* The maximum number of questions is decided by the instructor when creating the assignment. &lt;br /&gt;
&lt;br /&gt;
* The student has option to either create True/False, Multiple-Choice Checkbox or Multiple-Choice Radio question. &lt;br /&gt;
&lt;br /&gt;
* The question cannot be blank and correct answer must be selected to create a quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Drawbacks and Solutions=====&lt;br /&gt;
* '''Problem 1''':Rename filename such that it follows the coding standards&lt;br /&gt;
'''Solution''':Currently the file was named as quiz_questionnaire_controller.rb. This doesn't follow the Ruby naming standards. Hence it was changed to quiz_questionnaires_controller.rb&lt;br /&gt;
* '''Problem 2''':Remove redundant information from method names&lt;br /&gt;
'''Solution''':Since this controller was separated from the questionnaires_controller.rb, the method names were kept the same from the previous controller which had redundant information.&lt;br /&gt;
Method names were renamed by removing the succeeding '_quiz'. Also valid_quiz was renamed to validate_quiz to make more sense. Also the routes.rb was changed to accept these changes.&lt;br /&gt;
* '''Problem 3''':Add comments to methods and complex lines of code&lt;br /&gt;
'''Solution''':Many methods had more than 325 lines of code and performed multiple functionalities. These methods were changed by creating private methods that performed individual tasks, thus reducing the lines of code and the complexity.&lt;br /&gt;
* '''Problem 4''':Remove unsafe reflection method&lt;br /&gt;
'''Solution''':This part was already implemented, hence no changes were made.&lt;br /&gt;
* '''Problem 5''':Try to fix issues from Code Climate&lt;br /&gt;
'''Solution''':Refer to Solution for Problem 3&lt;br /&gt;
&lt;br /&gt;
===Code improvements===&lt;br /&gt;
* The method '''save_choices''' had a congnitive complexity of 23 and had 37 lines of code. By refactoring, the number of lines was reduced to 20 and private methods '''create_checkbox''', '''create_truefalse''' and '''create_radio''' were implemented to break up functionality and to reduce cognitive complexity.&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      params[:new_choices][question_num.to_s][q_type].each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][choice_key][:iscorrect] == 1.to_s&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          else&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      q_choices = params[:new_choices][question_num.to_s][q_type]&lt;br /&gt;
      q_choices.each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          create_checkbox(question, choice_key, q_choices)&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          create_truefalse(question, choice_key, q_choices)&lt;br /&gt;
        else # MultipleChoiceRadio&lt;br /&gt;
          create_radio(question, choice_key, q_choices)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''action_allowed?''' has been implemented in quiz_questionnaire_controller.rb to specifically allow Student to edit an existing quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The quiz_questionnaire_controller_spec.rb has been updated to allow edit tests to work for Student role.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let(:student) { build(:student, id: 8609) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role) #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role)  #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''update_quiz''' has been renamed to '''update''' and has been refactored to reduce the line count by breaking functionalities. (The function '''multiple_choice_checkbox''' was renamed to '''update_checkbox''' and '''multiple_choice_radio''' was renamed to '''update_radio''' so as to reduce function name length and bring consistency with methods performing create operations: '''create_radio''', '''create_checkbox''', '''create_truefalse''')&lt;br /&gt;
The Cognitive Complexity of update method has now been reduced to 15 (from 29).&amp;lt;br&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          multiple_choice_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          multiple_choice_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
            if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
              # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
            else # the statement is not correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
              # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          update_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          update_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          update_truefalse(question_choice) if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update_truefalse(question_choice)&lt;br /&gt;
    if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
      # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
    else # the statement is not correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
      # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''valid_quiz''' has been renamed to '''validate_quiz'''. The function  '''validate_question''' was extracted out to only validate the particular question. The part where quiz name was being verified was also taken out of the loop to only verify this once as opposed to verifying in each iteration, which was unnecessary.  The Cognitive Complexity of 12 has now been reduced to less than 5. &lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def valid_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
        valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
      elsif !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
        # A type isnt selected for a question&lt;br /&gt;
        valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        @new_question = Object.const_get(params[:question_type][i.to_s][:type]).create(txt: '', type: params[:question_type][i.to_s][:type], break_before: true)&lt;br /&gt;
        @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
        type = params[:question_type][i.to_s][:type]&lt;br /&gt;
        choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
        valid = if choice_info.nil?&lt;br /&gt;
                  &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  @new_question.isvalid(choice_info)&lt;br /&gt;
                end&lt;br /&gt;
      end&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
    if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
      valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
      valid = validate_question(i)&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_question(i)&lt;br /&gt;
    if !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
      # A type isn't selected for a question&lt;br /&gt;
      valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # The question type is dynamic, so const_get is necessary&lt;br /&gt;
      type = params[:question_type][i.to_s][:type]&lt;br /&gt;
      @new_question = Object.const_get(type).create(txt: '', type: type, break_before: true)&lt;br /&gt;
      @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
      choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
      valid = if choice_info.nil?&lt;br /&gt;
                &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
              else&lt;br /&gt;
                @new_question.isvalid(choice_info)&lt;br /&gt;
              end&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Link to [https://youtu.be/dVu0-LZcW1w video] showing the RSpec testing.&lt;br /&gt;
====Automated Testing using RSPEC====&lt;br /&gt;
[[File:RspecResults.png]]&lt;br /&gt;
&lt;br /&gt;
====Testing from Travis CI====&lt;br /&gt;
[[File:TravisCIBuild.png]]&lt;br /&gt;
[[File:GitChecksPass.png]]&lt;br /&gt;
&lt;br /&gt;
==Project Mentors==&lt;br /&gt;
&lt;br /&gt;
Edward Gehringer (efg@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akansha Mohan (amohan7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Shalin Rathi (sjrathi@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akshay Saxena (asaxena5@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Daniel Mendez (dmendez@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/shalinshal/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://youtu.be/dVu0-LZcW1w  Demo link] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126643</id>
		<title>CSC/ECE 517 Fall 2019 - Project E1947. Refactor quiz questionnaire controller.rb</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2019_-_Project_E1947._Refactor_quiz_questionnaire_controller.rb&amp;diff=126643"/>
		<updated>2019-10-29T05:49:32Z</updated>

		<summary type="html">&lt;p&gt;Sjrathi: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1947. Refactoring quiz_questionnaire_controller.rb==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza allows the instructor to create new assignments and customize new or existing assignments. It also allows the instructor to create a list of topics the students can sign up for. Students can form teams in Expertiza to work on various projects and assignments. Students can also peer review other students' submissions. Expertiza supports submission across various document types, including the URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
The following tasks were accomplished in this project:&lt;br /&gt;
&lt;br /&gt;
* Rename filename such that it follows the coding standards&lt;br /&gt;
* Remove redundant information from method names&lt;br /&gt;
* Add comments to methods and complex lines of code&lt;br /&gt;
* Remove unsafe reflection method&lt;br /&gt;
* Simplify RSpec&lt;br /&gt;
* Try to fix issues from Code Climate&lt;br /&gt;
&lt;br /&gt;
===About Quiz Questionnaire Controller===&lt;br /&gt;
This is a new controller, having recently been separated from questionnaires_controller.rb.  It is used to allow students to take quizzes.  The idea is that the author(s) of submitted work can write a quiz that is given to each reviewer before the reviewer is allowed to review the work.  If the reviewer does badly on the quiz, then we know not to trust the review. It is also possible to set up an Expertiza assignment so that some participants just take the quiz and don’t review the work.&lt;br /&gt;
&lt;br /&gt;
===Current Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Functionality=====&lt;br /&gt;
* A student can create a quiz questionnaire for the assignments that allow a quiz to be generated. This quiz will be taken by the reviewers, once they are done reviewing the development/project. Based on their answers the TA's can know whether to consider the reviewer's review or not based , because if the reviewer didn't perform well on the quiz, then it is likely that the review is not done properly. &lt;br /&gt;
&lt;br /&gt;
* The maximum number of questions is decided by the instructor when creating the assignment. &lt;br /&gt;
&lt;br /&gt;
* The student has option to either create True/False, Multiple-Choice Checkbox or Multiple-Choice Radio question. &lt;br /&gt;
&lt;br /&gt;
* The question cannot be blank and correct answer must be selected to create a quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
=====Drawbacks and Solutions=====&lt;br /&gt;
* '''Problem 1''':Rename filename such that it follows the coding standards&lt;br /&gt;
'''Solution''':Currently the file was named as quiz_questionnaire_controller.rb. This doesn't follow the Ruby naming standards. Hence it was changed to quiz_questionnaires_controller.rb&lt;br /&gt;
* '''Problem 2''':Remove redundant information from method names&lt;br /&gt;
'''Solution''':Since this controller was separated from the questionnaires_controller.rb, the method names were kept the same from the previous controller which had redundant information.&lt;br /&gt;
Method names were renamed by removing the succeeding '_quiz'. Also valid_quiz was renamed to validate_quiz to make more sense. Also the routes.rb was changed to accept these changes.&lt;br /&gt;
* '''Problem 3''':Add comments to methods and complex lines of code&lt;br /&gt;
'''Solution''':Many methods had more than 325 lines of code and performed multiple functionalities. These methods were changed by creating private methods that performed individual tasks, thus reducing the lines of code and the complexity.&lt;br /&gt;
* '''Problem 4''':Remove unsafe reflection method&lt;br /&gt;
'''Solution''':This part was already implemented, hence no changes were made.&lt;br /&gt;
* '''Problem 5''':Try to fix issues from Code Climate&lt;br /&gt;
'''Solution''':Refer to Solution for Problem 3&lt;br /&gt;
&lt;br /&gt;
===Code improvements===&lt;br /&gt;
* The method '''save_choices''' had a congnitive complexity of 23 and had 37 lines of code. By refactoring, the number of lines was reduced to 20 and private methods '''create_checkbox''', '''create_truefalse''' and '''create_radio''' were implemented to break up functionality and to reduce cognitive complexity.&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      params[:new_choices][question_num.to_s][q_type].each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][choice_key][:iscorrect] == 1.to_s&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          else&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;True&amp;quot;, iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
            q = QuizQuestionChoice.new(txt: &amp;quot;False&amp;quot;, iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
            q.save&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          q = if params[:new_choices][question_num.to_s][q_type][1.to_s][:iscorrect] == choice_key&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;true&amp;quot;, question_id: question.id)&lt;br /&gt;
              else&lt;br /&gt;
                QuizQuestionChoice.new(txt: params[:new_choices][question_num.to_s][q_type][choice_key][:txt], iscorrect: &amp;quot;false&amp;quot;, question_id: question.id)&lt;br /&gt;
              end&lt;br /&gt;
          q.save&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def save_choices(questionnaire_id)&lt;br /&gt;
    return unless params[:new_question] or params[:new_choices]&lt;br /&gt;
    questions = Question.where(questionnaire_id: questionnaire_id)&lt;br /&gt;
    question_num = 1&lt;br /&gt;
&lt;br /&gt;
    questions.each do |question|&lt;br /&gt;
      q_type = params[:question_type][question_num.to_s][:type]&lt;br /&gt;
      q_choices = params[:new_choices][question_num.to_s][q_type]&lt;br /&gt;
      q_choices.each_key do |choice_key|&lt;br /&gt;
        if q_type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          create_checkbox(question, choice_key, q_choices)&lt;br /&gt;
        elsif q_type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          create_truefalse(question, choice_key, q_choices)&lt;br /&gt;
        else # MultipleChoiceRadio&lt;br /&gt;
          create_radio(question, choice_key, q_choices)&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
      question_num += 1&lt;br /&gt;
      question.weight = 1&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''action_allowed?''' has been implemented in quiz_questionnaire_controller.rb to specifically allow Student to edit an existing quiz.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The quiz_questionnaire_controller_spec.rb has been updated to allow edit tests to work for Student role.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let(:student) { build(:student, id: 8609) }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire is not taken by anyone' do&lt;br /&gt;
      it 'renders questionnaires#edit page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role) #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(false)&lt;br /&gt;
        params = {id: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(response).to render_template(:edit)&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    context 'when current questionnaire has been taken by someone' do&lt;br /&gt;
      it 'shows flash[:error] message and redirects to submitted_content#view page' do&lt;br /&gt;
        stub_current_user(student, student.role.name, student.role)  #action only permitted for Student role&lt;br /&gt;
        allow(@questionnaire).to receive(:taken_by_anyone?).and_return(true)&lt;br /&gt;
        params = {id: 1, pid: 1}&lt;br /&gt;
        get :edit, params&lt;br /&gt;
        expect(flash[:error]).to eq('Your quiz has been taken by some other students, you cannot edit it anymore.')&lt;br /&gt;
        expect(response).to redirect_to('/submitted_content/view?id=1')&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''update_quiz''' has been renamed to '''update''' and has been refactored to reduce the line count by breaking functionalities. (The function '''multiple_choice_checkbox''' was renamed to '''update_checkbox''' and '''multiple_choice_radio''' was renamed to '''update_radio''' so as to reduce function name length and bring consistency with methods performing create operations: '''create_radio''', '''create_checkbox''', '''create_truefalse''')&lt;br /&gt;
The Cognitive Complexity of update method has now been reduced to 15 (from 29).&amp;lt;br&amp;gt;&lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          multiple_choice_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          multiple_choice_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
            if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
              # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
            else # the statement is not correct&lt;br /&gt;
              question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
              # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&lt;br /&gt;
            end&lt;br /&gt;
          end&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    @questionnaire = Questionnaire.find(params[:id])&lt;br /&gt;
    if @questionnaire.nil?&lt;br /&gt;
      redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
    if params['save'] &amp;amp;&amp;amp; params[:question].try(:keys)&lt;br /&gt;
      @questionnaire.update_attributes(questionnaire_params)&lt;br /&gt;
      params[:question].each_key do |qid|&lt;br /&gt;
        @question = Question.find(qid)&lt;br /&gt;
        @question.txt = params[:question][qid.to_sym][:txt]&lt;br /&gt;
        @question.save&lt;br /&gt;
        @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)&lt;br /&gt;
        question_index = 1&lt;br /&gt;
        @quiz_question_choices.each do |question_choice|&lt;br /&gt;
          # Call to private method to handle  Multile Choice Questions&lt;br /&gt;
          update_checkbox(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceCheckbox&amp;quot;&lt;br /&gt;
          update_radio(question_choice, question_index) if @question.type == &amp;quot;MultipleChoiceRadio&amp;quot;&lt;br /&gt;
          update_truefalse(question_choice) if @question.type == &amp;quot;TrueFalse&amp;quot;&lt;br /&gt;
          question_index += 1&lt;br /&gt;
        end&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update_truefalse(question_choice)&lt;br /&gt;
    if params[:quiz_question_choices][@question.id.to_s][@question.type][1.to_s][:iscorrect] == &amp;quot;True&amp;quot; # the statement is correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '1') : question_choice.update_attributes(iscorrect: '0')&lt;br /&gt;
      # the statement is correct so &amp;quot;True&amp;quot; is the right answer&lt;br /&gt;
    else # the statement is not correct&lt;br /&gt;
      question_choice.txt == &amp;quot;True&amp;quot; ? question_choice.update_attributes(iscorrect: '0') : question_choice.update_attributes(iscorrect: '1')&lt;br /&gt;
      # the statement is not correct so &amp;quot;False&amp;quot; is the right answer&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;
&amp;lt;br&amp;gt;&lt;br /&gt;
* The method '''valid_quiz''' has been renamed to '''validate_quiz'''. The function  '''validate_question''' was extracted out to only validate the particular question. The part where quiz name was being verified was also taken out of the loop to only verify this once as opposed to verifying in each iteration, which was unnecessary.  The Cognitive Complexity of 12 has now been reduced to less than 5. &lt;br /&gt;
'''Before:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def valid_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
        valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
      elsif !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
        # A type isnt selected for a question&lt;br /&gt;
        valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        @new_question = Object.const_get(params[:question_type][i.to_s][:type]).create(txt: '', type: params[:question_type][i.to_s][:type], break_before: true)&lt;br /&gt;
        @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
        type = params[:question_type][i.to_s][:type]&lt;br /&gt;
        choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
        valid = if choice_info.nil?&lt;br /&gt;
                  &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
                else&lt;br /&gt;
                  @new_question.isvalid(choice_info)&lt;br /&gt;
                end&lt;br /&gt;
      end&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
'''After:'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_quiz&lt;br /&gt;
    num_questions = Assignment.find(params[:aid]).num_quiz_questions&lt;br /&gt;
    valid = &amp;quot;valid&amp;quot;&lt;br /&gt;
    if params[:questionnaire][:name] == &amp;quot;&amp;quot; # questionnaire name is not specified&lt;br /&gt;
      valid = &amp;quot;Please specify quiz name (please do not use your name or id).&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    (1..num_questions).each do |i|&lt;br /&gt;
      break if valid != &amp;quot;valid&amp;quot;&lt;br /&gt;
      valid = validate_question(i)&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def validate_question(i)&lt;br /&gt;
    if !params.key?(:question_type) || !params[:question_type].key?(i.to_s) || params[:question_type][i.to_s][:type].nil?&lt;br /&gt;
      # A type isn't selected for a question&lt;br /&gt;
      valid = &amp;quot;Please select a type for each question&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      # The question type is dynamic, so const_get is necessary&lt;br /&gt;
      type = params[:question_type][i.to_s][:type]&lt;br /&gt;
      @new_question = Object.const_get(type).create(txt: '', type: type, break_before: true)&lt;br /&gt;
      @new_question.update_attributes(txt: params[:new_question][i.to_s])&lt;br /&gt;
      choice_info = params[:new_choices][i.to_s][type] # choice info for one question of its type&lt;br /&gt;
      valid = if choice_info.nil?&lt;br /&gt;
                &amp;quot;Please select a correct answer for all questions&amp;quot;&lt;br /&gt;
              else&lt;br /&gt;
                @new_question.isvalid(choice_info)&lt;br /&gt;
              end&lt;br /&gt;
    end&lt;br /&gt;
    valid&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Testing===&lt;br /&gt;
Link to [https://youtu.be/dVu0-LZcW1w video] showing the RSpec testing.&lt;br /&gt;
====Automated Testing using RSPEC====&lt;br /&gt;
[[File:RspecResults.png]]&lt;br /&gt;
&lt;br /&gt;
====Testing from Travis CI====&lt;br /&gt;
[[File:TravisCIBuild.png]]&lt;br /&gt;
[[File:GitChecksPass.png]]&lt;br /&gt;
&lt;br /&gt;
==Project Mentors==&lt;br /&gt;
&lt;br /&gt;
Edward Gehringer (efg@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akansha Mohan (amohan7@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Team Members==&lt;br /&gt;
Shalin Rathi (sjrathi@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Akshay Saxena (asaxena5@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
Daniel Mendez (dmendez@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/WintersLt/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[https://youtu.be/dVu0-LZcW1w  Demo link] &lt;br /&gt;
#[http://wikis.lib.ncsu.edu/index.php/Expertiza Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A handbook of agile software craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Sjrathi</name></author>
	</entry>
</feed>