<?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=Sli41</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=Sli41"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sli41"/>
	<updated>2026-05-11T17:26:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114835</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114835"/>
		<updated>2017-12-15T01:56:41Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Edge cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents. (instructor can include more document types in /views/submitted_content/_submitted_files.html.erb)&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;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission event. We would like to name the table as '''submission_viewing_events'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''source_link''' for submitted links or file names, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.jpg | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
For each task, reviewer might open each link several times, might also save the review process and restart it some times later, so we will have multiple records for each link. Every time the student click on the link, a new record is created and then the time in all records will be summed up to total time for every link and displayed on instructor page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent on each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We modifed code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:review_piechart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:E1791popup alert.jpg | center]]&lt;br /&gt;
&lt;br /&gt;
3. In some cases, reviewer might shut down the computer, close the browser, log out without saving, etc., we set up periodically saving reviewing events automatically such that we will lose as less information as possible. Currently the period is 30 seconds and this can be changed. For the cases described, shut down computer etc., there will be records written in data base with end time NULL, next time when the reviewer restart the review, the system will just drop all the records with NULL end time and start a new query. Also if reviewer does not interact with the review page for a long time, it will pause the timer and commit all existing related time record in database. The time limit is now 2 minutes. Both the period and non-interaction time can be adjusted by instructors in code file /views/response/response.html.erb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test whether the start time is updated to the end time last saved in the database when the user resumes a review;&lt;br /&gt;
&lt;br /&gt;
  describe '#response_start_time' do&lt;br /&gt;
    context 'when the link is opened and timed' do&lt;br /&gt;
      it 'should update time record with start time as end time' do&lt;br /&gt;
        response_time_records=double('ResponseTime')&lt;br /&gt;
        allow(ResponseTime).to receive(:where).with([:map_id,:round,:link]).and_return(response_time_records)&lt;br /&gt;
        dummy = double('BasicObject')&lt;br /&gt;
        allow(ResponseTime).to receive(:end_at).and_return(dummy)&lt;br /&gt;
        allow(dummy).to receive(:nil?).and_return(true)&lt;br /&gt;
        allow(ResponseTime).to receive(:update_attributes).with(:end_at,:start_at).and_return(response_time_records)&lt;br /&gt;
        expect(response.body).to be_blank&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test whether the end time is updated as the current time when the review is saved to the database.&lt;br /&gt;
&lt;br /&gt;
 describe '#response_end_time' do&lt;br /&gt;
    context 'when response does not have a end time' do&lt;br /&gt;
      it 'should update time record with end time as current time' do&lt;br /&gt;
        response_time_records=double('ResponseTime')&lt;br /&gt;
        allow(ResponseTime).to receive(:where).with([:map_id,:round,:link]).and_return(response_time_records)&lt;br /&gt;
        dummy = double('BasicObject')&lt;br /&gt;
        allow(ResponseTime).to receive(:end_at).and_return(dummy)&lt;br /&gt;
        allow(dummy).to receive(:nil?).and_return(true)&lt;br /&gt;
        allow(ResponseTime).to receive(:update_attributes).with(:end_at,Time.now.to_date).and_return(response_time_records)&lt;br /&gt;
        expect(response.body).to be_blank&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
submission_viewing_events.rb &amp;lt;br&amp;gt;&lt;br /&gt;
submission_viewing_events_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helpers/submitted_content_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
In this project, we accomplished the requirement defined in the project instructions. However, due to the complexity of the Expertiza system and limited time period, there are still several points to improve in the future:&lt;br /&gt;
&lt;br /&gt;
1. Improve the accuracy of review time record. To record the exact time that the user spends on each link or file, it is more accurate to track the active time of each new window or tab of these links or online files. We attempted this design using 'window.focus()', but it does not work once the user moved away from the review page and turned to other applications. So either tweaking the web setting or using browser APIs may solve this problem.&lt;br /&gt;
&lt;br /&gt;
2. Notify the user when no response on the review page. Occasionally the user may open the review page to do the review, but is interrupted to focus on other applications. In this case, we stopped the time recording but try to alert the user that if he wants to continue the review. However, this notice cannot show in time if the user is not focusing on that review page. So a global alert is necessary to save the time and provide notice on time.&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1124 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114833</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114833"/>
		<updated>2017-12-15T01:51:53Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Type of submitted files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents. (instructor can include more document types in /views/submitted_content/_submitted_files.html.erb)&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;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission event. We would like to name the table as '''submission_viewing_events'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''source_link''' for submitted links or file names, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.jpg | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
For each task, reviewer might open each link several times, might also save the review process and restart it some times later, so we will have multiple records for each link. Every time the student click on the link, a new record is created and then the time in all records will be summed up to total time for every link and displayed on instructor page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent on each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:review_piechart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:E1791popup alert.jpg | center]]&lt;br /&gt;
&lt;br /&gt;
3. In some cases, reviewer might shut down the computer, close the browser, log out without saving, etc., we set up periodically saving reviewing events automatically such that we will lose as less information as possible. Currently the period is 30 seconds and this can be changed. For the cases described, shut down computer etc., there will be records written in data base with end time NULL, next time when the reviewer restart the review, the system will just drop all the records with NULL end time and start a new query.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test whether the start time is updated to the end time last saved in the database when the user resumes a review;&lt;br /&gt;
&lt;br /&gt;
  describe '#response_start_time' do&lt;br /&gt;
    context 'when the link is opened and timed' do&lt;br /&gt;
      it 'should update time record with start time as end time' do&lt;br /&gt;
        response_time_records=double('ResponseTime')&lt;br /&gt;
        allow(ResponseTime).to receive(:where).with([:map_id,:round,:link]).and_return(response_time_records)&lt;br /&gt;
        dummy = double('BasicObject')&lt;br /&gt;
        allow(ResponseTime).to receive(:end_at).and_return(dummy)&lt;br /&gt;
        allow(dummy).to receive(:nil?).and_return(true)&lt;br /&gt;
        allow(ResponseTime).to receive(:update_attributes).with(:end_at,:start_at).and_return(response_time_records)&lt;br /&gt;
        expect(response.body).to be_blank&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test whether the end time is updated as the current time when the review is saved to the database.&lt;br /&gt;
&lt;br /&gt;
 describe '#response_end_time' do&lt;br /&gt;
    context 'when response does not have a end time' do&lt;br /&gt;
      it 'should update time record with end time as current time' do&lt;br /&gt;
        response_time_records=double('ResponseTime')&lt;br /&gt;
        allow(ResponseTime).to receive(:where).with([:map_id,:round,:link]).and_return(response_time_records)&lt;br /&gt;
        dummy = double('BasicObject')&lt;br /&gt;
        allow(ResponseTime).to receive(:end_at).and_return(dummy)&lt;br /&gt;
        allow(dummy).to receive(:nil?).and_return(true)&lt;br /&gt;
        allow(ResponseTime).to receive(:update_attributes).with(:end_at,Time.now.to_date).and_return(response_time_records)&lt;br /&gt;
        expect(response.body).to be_blank&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
submission_viewing_events.rb &amp;lt;br&amp;gt;&lt;br /&gt;
submission_viewing_events_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helpers/submitted_content_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
In this project, we accomplished the requirement defined in the project instructions. However, due to the complexity of the Expertiza system and limited time period, there are still several points to improve in the future:&lt;br /&gt;
&lt;br /&gt;
1. Improve the accuracy of review time record. To record the exact time that the user spends on each link or file, it is more accurate to track the active time of each new window or tab of these links or online files. We attempted this design using 'window.focus()', but it does not work once the user moved away from the review page and turned to other applications. So either tweaking the web setting or using browser APIs may solve this problem.&lt;br /&gt;
&lt;br /&gt;
2. Notify the user when no response on the review page. Occasionally the user may open the review page to do the review, but is interrupted to focus on other applications. In this case, we stopped the time recording but try to alert the user that if he wants to continue the review. However, this notice cannot show in time if the user is not focusing on that review page. So a global alert is necessary to save the time and provide notice on time.&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1124 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114831</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114831"/>
		<updated>2017-12-15T01:48:15Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114829</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114829"/>
		<updated>2017-12-15T01:43:17Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114828</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114828"/>
		<updated>2017-12-15T01:41:56Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114826</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114826"/>
		<updated>2017-12-15T01:39:25Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114489</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114489"/>
		<updated>2017-12-06T04:23:58Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Project Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Design pattern ===&lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:review_piechart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:Alert_popup.png | center]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
In this project, we accomplished the requirement defined in the project instructions. However, due to the complexity of the Expertiza system and limited time period, there are still several points to improve in the future:&lt;br /&gt;
&lt;br /&gt;
1. Improve the accuracy of review time record. To record the exact time that the user spends on each link or file, it is more accurate to track the active time of each new window or tab of these links or online files. We attempted this design using 'window.focus()', but it does not work once the user moved away from the review page and turned to other applications. So either tweaking the web setting or using browser APIs may solve this problem.&lt;br /&gt;
&lt;br /&gt;
2. Notify the user when no response on the review page. Occasionally the user may open the review page to do the review, but is interrupted to focus on other applications. In this case, we stopped the time recording but try to alert the user that if he wants to continue the review. However, this notice cannot show in time if the user is not focusing on that review page. So a global alert is necessary to save the time and provide notice on time.&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1124 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114459</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114459"/>
		<updated>2017-12-05T15:21:57Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:review_piechart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:Alert_popup.png | center]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
In this project, we accomplished the requirement defined in the project instructions. However, due to the complexity of the Expertiza system and limited time period, there are still several points to improve in the future:&lt;br /&gt;
&lt;br /&gt;
1. Improve the accuracy of review time record. To record the exact time that the user spends on each link or file, it is more accurate to track the active time of each new window or tab of these links or online files. We attempted this design using 'window.focus()', but it does not work once the user moved away from the review page and turned to other applications. So either tweaking the web setting or using browser APIs may solve this problem.&lt;br /&gt;
&lt;br /&gt;
2. Notify the user when no response on the review page. Occasionally the user may open the review page to do the review, but is interrupted to focus on other applications. In this case, we stopped the time recording but try to alert the user that if he wants to continue the review. However, this notice cannot show in time if the user is not focusing on that review page. So a global alert is necessary to save the time and provide notice on time.&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114458</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114458"/>
		<updated>2017-12-05T15:11:07Z</updated>

		<summary type="html">&lt;p&gt;Sli41: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:review_piechart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:Alert_popup.png | center]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Future Work ==&lt;br /&gt;
&lt;br /&gt;
In this project, we accomplished the requirement defined in the project instructions. However, due to the complexity of the expertiza system and limited time period, there is still several points to improve in the future:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114457</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114457"/>
		<updated>2017-12-05T06:35:34Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114456</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114456"/>
		<updated>2017-12-05T06:34:26Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114455</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114455"/>
		<updated>2017-12-05T06:33:49Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114453</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114453"/>
		<updated>2017-12-05T04:31:47Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* View modification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:review_piechart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:Alert_popup.png | center]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114452</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114452"/>
		<updated>2017-12-05T04:30:23Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114451</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114451"/>
		<updated>2017-12-05T04:29:28Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114450</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114450"/>
		<updated>2017-12-05T04:26:23Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Review piechart.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114449</id>
		<title>File:Review piechart.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Review_piechart.png&amp;diff=114449"/>
		<updated>2017-12-05T04:25:25Z</updated>

		<summary type="html">&lt;p&gt;Sli41: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114410</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114410"/>
		<updated>2017-12-04T06:05:31Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Edge cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
[[File:Alert_popup.png | center]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Alert_popup.png&amp;diff=114409</id>
		<title>File:Alert popup.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Alert_popup.png&amp;diff=114409"/>
		<updated>2017-12-04T06:04:28Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Alert popup.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114408</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114408"/>
		<updated>2017-12-04T06:00:55Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Edge cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114407</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114407"/>
		<updated>2017-12-04T05:57:23Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Edge cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
[[File:Alert_popup.png | center]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Alert_popup.png&amp;diff=114406</id>
		<title>File:Alert popup.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Alert_popup.png&amp;diff=114406"/>
		<updated>2017-12-04T05:56:33Z</updated>

		<summary type="html">&lt;p&gt;Sli41: uploaded a new version of &amp;amp;quot;File:Alert popup.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Alert_popup.png&amp;diff=114405</id>
		<title>File:Alert popup.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Alert_popup.png&amp;diff=114405"/>
		<updated>2017-12-04T05:55:57Z</updated>

		<summary type="html">&lt;p&gt;Sli41: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114404</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114404"/>
		<updated>2017-12-04T05:28:35Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Project Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Project Github repo]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114403</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114403"/>
		<updated>2017-12-04T05:22:02Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Used DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114402</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114402"/>
		<updated>2017-12-04T05:21:16Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the general solutions we designed and implemented in this project:&lt;br /&gt;
&lt;br /&gt;
*Designed a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Designed and implemented dynamic partial components using Javascript and Ruby to open students’ submissions in new windows to view online;&lt;br /&gt;
*Use DOM to control the windows holding review submission files or links, and record the open and close time;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the total and detailed time spent on each review submissions with visualization.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114401</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114401"/>
		<updated>2017-12-04T05:14:09Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Problem Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using jQuery and DOM;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description and Solution ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114400</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114400"/>
		<updated>2017-12-04T05:13:23Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using jQuery and DOM;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114399</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114399"/>
		<updated>2017-12-04T05:10:38Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Edge cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
3. If the reviewer opens the reference links or download files, but leave them open and turn to focus other unrelated stuff, the review page will send a popup alert dialog to confirm if the review is still in review mode. If not, it will close these windows and save the time as approximation of end time. Otherwise, it will continue the review process.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114398</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114398"/>
		<updated>2017-12-04T05:05:27Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Related Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
db/migrate/20171117190721_create_response_times.rb &amp;lt;br&amp;gt;&lt;br /&gt;
config/routes.rb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114397</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114397"/>
		<updated>2017-12-04T04:51:09Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Related Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
review_time.rb &amp;lt;br&amp;gt;&lt;br /&gt;
responses_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response_times_controller.rb &amp;lt;br&amp;gt;&lt;br /&gt;
helper/review_mapping_helper.rb &amp;lt;br&amp;gt;&lt;br /&gt;
response/response.html.erb  &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_report.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
review_mapping/_review_submissions_time_spent.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/popup/reviewer_details_popup.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_hyperlink.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
view/submitted_content/_submitted_files.html.erb &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114396</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=114396"/>
		<updated>2017-12-04T00:58:41Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Project Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which uses '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png | center]]&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
[[File:E1791_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
1. When user click on save or submit the review without closing opened windows, the system will search all records of response time for the reviewer and reviewee where end time is NULL, and update it with current time.&lt;br /&gt;
&lt;br /&gt;
2. When user leave the review page by accident, such as by logging out, shutting down browser, going back to home page without saving review, records corresponding to this review will be left in the database with end time NULL. We would think time for this review as invalid, since it is not saved or submitted. Next time, when the user restart the review, for each clicked link system will check if there exist records with NULL end time for the same map id and hyperlink, and if exists, drop it before insert new query into database.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
&lt;br /&gt;
describe ResponseTimesController do&lt;br /&gt;
  describe '#action_allowed?' do&lt;br /&gt;
    it &amp;quot;should return true&amp;quot; do&lt;br /&gt;
      expect(true).to be_truthy&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. response_times_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
1. [https://github.com/expertiza/expertiza/pull/1102 Github pull request link]&lt;br /&gt;
&lt;br /&gt;
2. [https://youtu.be/IMTBqiKth-k Screen cast youtube link]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113625</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113625"/>
		<updated>2017-11-15T23:17:31Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Rspec Test */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
User shuts down browser during review.&amp;lt;br&amp;gt;&lt;br /&gt;
User logs out while review reference windows still open.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development:&lt;br /&gt;
* Test the success of a review time record given valid start and end time;&lt;br /&gt;
* Test the error handler when a review time record fails to save;&lt;br /&gt;
* Test the calculation of the total review time for the same link.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113621</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113621"/>
		<updated>2017-11-15T23:04:47Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* View modification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible by adding additional view components without affecting current functions.&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
User shuts down browser during review.&amp;lt;br&amp;gt;&lt;br /&gt;
User logs out while review reference windows still open.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113620</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113620"/>
		<updated>2017-11-15T23:03:37Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Edge cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible without affecting current functions.&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
User shuts down browser during review.&amp;lt;br&amp;gt;&lt;br /&gt;
User logs out while review reference windows still open.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113619</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113619"/>
		<updated>2017-11-15T23:03:24Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* View modification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. This framework follows well the &amp;quot;open to extension and close to modification&amp;quot; principle, which makes further changes more feasible without affecting current functions.&lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
User shuts down browser during review.&lt;br /&gt;
User logs out while review reference windows still open.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113616</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113616"/>
		<updated>2017-11-15T22:53:13Z</updated>

		<summary type="html">&lt;p&gt;Sli41: update edge cases&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. &lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
User shuts down browser during review.&lt;br /&gt;
User logs out while review reference windows still open.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113615</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=113615"/>
		<updated>2017-11-15T22:47:40Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Time tracking mechanism */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links and txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. This is done by controlling DOM using jQuery javascript library, and then send back the time records through Ajax. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. &lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112803</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112803"/>
		<updated>2017-11-10T06:55:20Z</updated>

		<summary type="html">&lt;p&gt;Sli41: add Team&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
=== Type of submitted files ===&lt;br /&gt;
For most of our tasks, there are two types of submitted files. &lt;br /&gt;
&lt;br /&gt;
1. One kind is online links, such as github repo or pull request link, youtube video link, expertiza wiki page link, etc&lt;br /&gt;
&lt;br /&gt;
2. The other one includes files such as pdf, txt, doc, images, etc and other download contents.&lt;br /&gt;
&lt;br /&gt;
=== Database shcema design ===&lt;br /&gt;
For this project, we need to design a database table to store all the time that we need to record for each review submission. We would like to name the table as '''review_time'''. For the table, we would use '''map_id''' in table response, which used as '''response_map_id''' as the primary information. Then we need to record '''reviewer_id''' and '''reviewee_id''', '''file_link''' for submitted files, as well as time '''start_at''' and '''end_at''', then store them in the table.&lt;br /&gt;
&lt;br /&gt;
[[File:E1791db.png]]&lt;br /&gt;
&lt;br /&gt;
=== Time tracking mechanism ===&lt;br /&gt;
&lt;br /&gt;
[[File:E1791_flowchart.png]]&lt;br /&gt;
&lt;br /&gt;
For each review, when the reviewer click on one link of the submitted files, we create an entry to the table review_time, we will write a function to record current time to the database. &lt;br /&gt;
&lt;br /&gt;
For how to determine time when the reviewer complete with the opened link, there are different cases. If the reviewer click on save or submit button, close the page, or logout, we need to write to all open entry (without end_at) respect to this review and save current time to end_at. But for how to decide when the review close the opened link is a little complicated. For github and youtube links, because they are external links, we need some to use third-party APIs such as gem: https://github.com/octokit/octokit.rb,  such that we can record close time. For txt, pdf, doc, image files, we will open submitted files in views/response/_submitted_files.html.erb so that when the user click on the link, it opens a popup window that shows the submission, record time when it opens and closes. For the other files that need to be downloaded, we can only make an approximation by record the time when the reviewer click on the link until the time he/she enter the reviews.&lt;br /&gt;
&lt;br /&gt;
=== View modification ===&lt;br /&gt;
After we record start_at and end_at time for each piece of review, we need to display time that each reviewer spent for each link. Because the reviewer may save the review and start again in the future, so for each link there might be several entries, we need to sum them together. We will try to modify code in review_mapping/_review_report.html.erb first to modify the view. &lt;br /&gt;
&lt;br /&gt;
=== Edge cases ===&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
=== UI and Manual test ===&lt;br /&gt;
We will test the following cases during our development&lt;br /&gt;
&lt;br /&gt;
1. When we work the review, if we click on GitHub link, GitHub pull request link, check whether the system record review time correctly.&lt;br /&gt;
&lt;br /&gt;
2. When we work the review, if we click on doc, pdf, image link, check whether system open submitted files in views/response/_submitted_files.html.erb and recore the review time correctly.&lt;br /&gt;
&lt;br /&gt;
3. Check if the reviewer save the process and start again with click on same clink, check whether the system will record all the entry, and on the view page take all entries for one link into account.&lt;br /&gt;
&lt;br /&gt;
=== Rspec Test ===&lt;br /&gt;
Test of new model and function will be written and tested during project development.&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
1. review_time.rb&lt;br /&gt;
&lt;br /&gt;
2. response_controller.rb&lt;br /&gt;
&lt;br /&gt;
3. response/response.html.erb &lt;br /&gt;
&lt;br /&gt;
4. review_time_controller.rb&lt;br /&gt;
&lt;br /&gt;
5. review_mapping/_review_report.html.erb &lt;br /&gt;
&lt;br /&gt;
6. review_mapping/_review_submissions_time_spent.html.erb&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:wsun12@ncsu.edu Wei Sun]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:asundar2@ncsu.edu Aishwarya Sundararajan]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:dbhanda@ncsu.edu Darshan Balakrishna Bhandari]&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112087</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112087"/>
		<updated>2017-11-07T00:43:29Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Problem Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
&lt;br /&gt;
Our team is going to solve the submission review time tracking by attempting to open the downloaded files inside popup windows of the web browser in order to record the time on the client side. &lt;br /&gt;
&lt;br /&gt;
Type of submitted files:&lt;br /&gt;
&lt;br /&gt;
Database shcema design:&lt;br /&gt;
&lt;br /&gt;
Time tracking mechanism:&lt;br /&gt;
&lt;br /&gt;
View modification:&lt;br /&gt;
&lt;br /&gt;
Edge cases:&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112082</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112082"/>
		<updated>2017-11-07T00:40:16Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Problem Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Problem Description ==&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112081</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112081"/>
		<updated>2017-11-07T00:38:18Z</updated>

		<summary type="html">&lt;p&gt;Sli41: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The expertiza project takes advantage of peer-review among students to allow them to learn from each other. To track the review time that each student spend on each submitted resources is meaningful to instructors to study and improve the teach experience. However, the time tracking of specific content on these resources is not perfect in the expertiza system. The previous team working on E1705 project has solved part of such problems by tracking the active time of windows opened from the submitted links. But for the submitted files which could be downloaded for local review, there is only a rough approximation solution yet. In this project, our team is going to solve this problem as well as improving previous time tracking methods using mature third-party APIs to record link review time more accurately. To accomplish this goal, here are the tasks needed to be done:&lt;br /&gt;
&lt;br /&gt;
*Design a database schema for logging the time a reviewer spend on a submission;&lt;br /&gt;
*Design and implement a solution that handles the use case, where students’ submissions are hosted on an external website using third-party APIs, e.g. gem: [https://github.com/octokit/octokit.rb Octokit] for Github use case;&lt;br /&gt;
*Modify Review report (views/review_mapping/_review_report.html.erb) to show the time spent on each submission.&lt;br /&gt;
&lt;br /&gt;
== Task List ==&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112079</id>
		<title>CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1791._Track_the_time_that_students_look_at_the_other_submissions_-_logging_improvement&amp;diff=112079"/>
		<updated>2017-11-07T00:22:42Z</updated>

		<summary type="html">&lt;p&gt;Sli41: set up project wiki page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
== Task List ==&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
== Related Files ==&lt;br /&gt;
&lt;br /&gt;
== Project Links ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017&amp;diff=112078</id>
		<title>CSC/ECE 517 Fall 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017&amp;diff=112078"/>
		<updated>2017-11-07T00:16:35Z</updated>

		<summary type="html">&lt;p&gt;Sli41: add new final project design document&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Design Project Documentation'''&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A2 Lightweight Badging System]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A8. Use a profiler to identify the problems / pages that take some time to load &amp;amp; fix them]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1793. Help students find teams to join]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A4 Allow calibration to be part of an assignment]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E17A0 Team-based reviewing]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1793. Help students find teams to join_Team1964]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1791. Track the time that students look at the other submissions - logging improvement]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1799 Improve self-review Link peer review &amp;amp; self-review to derive grades]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submissions]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E17A1|CSC/ECE_517_Fall_2017/E17A1 - Let experts as well as students do reviews]]&lt;br /&gt;
'''Writing Assignment 2'''&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1779. Fix teammate advertisements and requests to join a team]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1773 Investigate and Fix Expertiza Production Version Runtime Exceptions.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1774 Metareview fixes and improvements.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1788 OSS project Maroon Heatmap fixes]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1781 Topic Management]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1745_Refactor_response_controller.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1752 Refactor assignments controller]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1776_Enhance_Imports]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1756 TLD Refactor response.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1772_Refactor reputation_web_service_controller.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/M1754_Mutation Testing on Servo]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1753 OSS project bidding tests]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1766_Test team functionality]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1767 Improve imports]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1786_OSS project Juniper Bookmark Enhancements]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1787_OSS project Bronze Score calculations]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1763 Fix Staggered-Deadline Assignments]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1757 Introduce a Student View for instructors]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1769_Refactor assignment_form.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1754_Feature_test_of_rubric_advice]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1782 OSS Project Red Assignment Directories]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1748 Add past-due assignments to task list]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1761 Test First Development Refactor assignment.rb]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1780_OSS_Project_Teal_Email_Notification_Enhancements]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1762 Test various kinds of response-map hierarchies]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1759 ]]&lt;br /&gt;
*[[CSC/ECE_517_Fall_2017/E1749_Test First Development Refactor questionnaire_controller.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1777 Coherent specification of review requirements.rb]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2017/E1771_Refactor_team.rb]]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110945</id>
		<title>CSC/ECE 517 Fall 2017/E1752 Refactor assignments controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110945"/>
		<updated>2017-10-30T00:52:04Z</updated>

		<summary type="html">&lt;p&gt;Sli41: change names of methods in edit and update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Expertiza is an open source webapp built on Ruby on Rails stack. It provides a platform to students with various features like peer-reviewing projects, submitting work, form teams, viewing grades etc. The project is being built and maintained by students and faculty at NCSU.&lt;br /&gt;
&lt;br /&gt;
==About Assignments Controller==&lt;br /&gt;
The file assignments_controller.rb handles the logic behind Expertiza assignments and enables the creation and managements of assignments by instructional staff. Besides regular CRUD operations, it also integrates multiple parts of the expertiza components, such as users of different authorizations and priorities, corresponding courses associated with the assignment, due date and so on. Therefore, further unit and integration tests are required to guarantee that these operations work as expected. And also refactoring on the code in this controller is needed to make it more readable and reduce the complexity at the same time. Our tasks are based on the motivations above.&lt;br /&gt;
&lt;br /&gt;
==About Software Testing==&lt;br /&gt;
Software testing is a process of examining a program or application with the intent of finding the software bugs. In software developemnt, it is usually defined as the process of validating and verifying that a software program or application or product meets the specified business and technical requirements.&lt;br /&gt;
&lt;br /&gt;
Additionaly, software is tested to:&lt;br /&gt;
* Detect and rectify and errors made during the development phase,&lt;br /&gt;
* Ensure customer satisfaction in the application,&lt;br /&gt;
* Ensure the quality of the software product and&lt;br /&gt;
* Optimize the performance of the system.&lt;br /&gt;
&lt;br /&gt;
Our project is guided by the Test-First Development principle. We write passing and failing tests for use cases of the assignment controller, and then turn to refactor the code. During the project, we implement the tests and refactor in Agile methodology with our mentor Zhewei through weekly delivery.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code. It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. &lt;br /&gt;
&lt;br /&gt;
The Expertiza project makes extensive use of RSpec to test the various components of the application. Tests of our tasks are in the code file: spec/controllers/assignments_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
===Testing actions perfomed===&lt;br /&gt;
* Creating new tests for each method, &lt;br /&gt;
* Testing the each method and making sure the tests pass.&lt;br /&gt;
&lt;br /&gt;
===Testing results===&lt;br /&gt;
All 22 tests were passed with zero failure on the final version of project code.&lt;br /&gt;
&lt;br /&gt;
==About Refactoring==&lt;br /&gt;
Refactoring of computer software or code is the process of restructuring existing software code without changing its external behavior or performance of the software application. Refactoring improves nonfunctional attributes of the software. Refactoring aids in code readability and keeps the code well maintained and easy to understand.&lt;br /&gt;
&lt;br /&gt;
===Refactoring actions perfomed===&lt;br /&gt;
* Replace magic numbers in deadline_type_id by constants with reasonable names;&lt;br /&gt;
* Formatting the code for readability and convention;&lt;br /&gt;
* Split large chunks of code in to smaller manageable chunks;&lt;br /&gt;
* Extract simpler and specific methods out of blocks of codes to remove code duplications using DRY principle;&lt;br /&gt;
* Rename existing methods with meaningful names for better readability without change on external functionality.&lt;br /&gt;
&lt;br /&gt;
===Refactor edit method===&lt;br /&gt;
Actions: code block split, method extraction and add meaningful constants&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def edit&lt;br /&gt;
    # give an error message is instructor have not set the time zone.&lt;br /&gt;
    if current_user.timezonepref.nil?&lt;br /&gt;
      flash.now[:error] = &amp;quot;You have not specified your preferred timezone yet. Please do this before you set up the deadlines.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: params[:id])&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @user = current_user&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: params[:id])&lt;br /&gt;
    @due_date_all = AssignmentDueDate.where(parent_id: params[:id])&lt;br /&gt;
    @reviewvarycheck = false&lt;br /&gt;
    @due_date_nameurl_notempty = false&lt;br /&gt;
    @due_date_nameurl_notempty_checkbox = false&lt;br /&gt;
    @metareview_allowed = false&lt;br /&gt;
    @metareview_allowed_checkbox = false&lt;br /&gt;
    @signup_allowed = false&lt;br /&gt;
    @signup_allowed_checkbox = false&lt;br /&gt;
    @drop_topic_allowed = false&lt;br /&gt;
    @drop_topic_allowed_checkbox = false&lt;br /&gt;
    @team_formation_allowed = false&lt;br /&gt;
    @team_formation_allowed_checkbox = false&lt;br /&gt;
    @participants_count = @assignment_form.assignment.participants.size&lt;br /&gt;
    @teams_count = @assignment_form.assignment.teams.size&lt;br /&gt;
&lt;br /&gt;
    if @assignment_form.assignment.staggered_deadline == true&lt;br /&gt;
      @review_rounds = @assignment_form.assignment.num_review_rounds&lt;br /&gt;
      @assignment_submission_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == 1 }&lt;br /&gt;
      @assignment_review_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == 2 }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Check if name and url in database is empty before webpage displays&lt;br /&gt;
    @due_date_all.each do |dd|&lt;br /&gt;
      @due_date_nameurl_notempty = is_due_date_nameurl_notempty(dd)&lt;br /&gt;
      @due_date_nameurl_notempty_checkbox = @due_date_nameurl_notempty&lt;br /&gt;
      @metareview_allowed = is_meta_review_allowed?(dd)&lt;br /&gt;
      @drop_topic_allowed = is_drop_topic_allowed?(dd)&lt;br /&gt;
      @signup_allowed = is_signup_allowed?(dd)&lt;br /&gt;
      @team_formation_allowed = is_team_formation_allowed?(dd)&lt;br /&gt;
&lt;br /&gt;
      if dd.due_at.present?&lt;br /&gt;
        dd.due_at = dd.due_at.to_s.in_time_zone(current_user.timezonepref)&lt;br /&gt;
      end&lt;br /&gt;
      if  @due_date_nameurl_notempty &amp;amp;&amp;amp; @due_date_nameurl_notempty_checkbox &amp;amp;&amp;amp;&lt;br /&gt;
          (@metareview_allowed || @drop_topic_allowed || @signup_allowed || @team_formation_allowed)&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires.each do |aq|&lt;br /&gt;
      unless aq.used_in_round.nil?&lt;br /&gt;
        @reviewvarycheck = 1&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @due_date_all = update_nil_dd_deadline_name(@due_date_all)&lt;br /&gt;
    @due_date_all = update_nil_dd_description_url(@due_date_all)&lt;br /&gt;
&lt;br /&gt;
    # only when instructor does not assign rubrics and in assignment edit page will show this error message.&lt;br /&gt;
    if !empty_rubrics_list.empty? &amp;amp;&amp;amp; request.original_fullpath == &amp;quot;/assignments/#{@assignment_form.assignment.id}/edit&amp;quot;&lt;br /&gt;
      rubrics_needed = needed_rubrics(empty_rubrics_list)&lt;br /&gt;
      flash.now[:error] = &amp;quot;You did not specify all the necessary rubrics. You need &amp;quot; + rubrics_needed +&lt;br /&gt;
          &amp;quot; of assignment &amp;lt;b&amp;gt;#{@assignment_form.assignment.name}&amp;lt;/b&amp;gt; before saving the assignment. You can assign rubrics &amp;lt;a id='go_to_tabs2' style='color: blue;'&amp;gt;here&amp;lt;/a&amp;gt;.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if @assignment_form.assignment.directory_path.nil? || @assignment_form.assignment.directory_path.empty?&lt;br /&gt;
      flash.now[:error] = &amp;quot;You did not specify your submission directory.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def edit&lt;br /&gt;
    handle_current_user_timezonepref_nil&lt;br /&gt;
&lt;br /&gt;
    edit_params_setting&lt;br /&gt;
&lt;br /&gt;
    assignment_form_assignment_staggered_deadline?&lt;br /&gt;
&lt;br /&gt;
    @due_date_all.each do |dd|&lt;br /&gt;
      check_due_date_nameurl_notempty(dd)&lt;br /&gt;
&lt;br /&gt;
      adjust_timezone_when_due_date_present(dd)&lt;br /&gt;
&lt;br /&gt;
      break if validate_due_date&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    check_assignment_questionnaires_usage&lt;br /&gt;
&lt;br /&gt;
    @due_date_all = update_nil_dd_deadline_name(@due_date_all)&lt;br /&gt;
    @due_date_all = update_nil_dd_description_url(@due_date_all)&lt;br /&gt;
&lt;br /&gt;
    # only when instructor does not assign rubrics and in assignment edit page will show this error message.&lt;br /&gt;
    handle_rubrics_not_assigned_case&lt;br /&gt;
&lt;br /&gt;
    handle_assignment_directory_path_nonexist_case&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we first grouped the blocks of code according to their similarity of functions. Then we extracted simpler methods from each code block to make it more readable and reduce the complexity and coupling. It is obvious that after refactoring, this part is simpler and easier to maintain. In addition, we also replaced the magic numbers by constants according to the deadline type.&lt;br /&gt;
&lt;br /&gt;
===Refactor update method===&lt;br /&gt;
Actions: split long code block and extract specific methods&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    unless params.key?(:assignment_form)&lt;br /&gt;
      @assignment = Assignment.find(params[:id])&lt;br /&gt;
      @assignment.course_id = params[:course_id]&lt;br /&gt;
      if @assignment.save&lt;br /&gt;
        flash[:note] = 'The assignment was successfully saved.'&lt;br /&gt;
        redirect_to list_tree_display_index_path&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to save the assignment: #{@assignment.errors.full_messages.join(' ')}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path @assignment.id&lt;br /&gt;
      end&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @assignment_form.assignment.instructor ||= current_user&lt;br /&gt;
    params[:assignment_form][:assignment_questionnaire].reject! do |q|&lt;br /&gt;
      q[:questionnaire_id].empty?&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if current_user.timezonepref.nil?&lt;br /&gt;
      parent_id = current_user.parent_id&lt;br /&gt;
      parent_timezone = User.find(parent_id).timezonepref&lt;br /&gt;
      flash[:error] = &amp;quot;We strongly suggest that instructors specify their preferred timezone to guarantee the correct display time. For now we assume you are in &amp;quot; + parent_timezone&lt;br /&gt;
      current_user.timezonepref = parent_timezone&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment_form.update_attributes(assignment_form_params, current_user)&lt;br /&gt;
      flash[:note] = 'The assignment was successfully saved....'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = &amp;quot;Failed to save the assignment: #{@assignment_form.errors.get(:message)}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    unless params.key?(:assignment_form)&lt;br /&gt;
      assignment_form_key_nonexist_case_handler&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    retrieve_assignment_form&lt;br /&gt;
&lt;br /&gt;
    handle_current_user_timezonepref_nil&lt;br /&gt;
&lt;br /&gt;
    feedback_assignment_form_attributes_update&lt;br /&gt;
&lt;br /&gt;
    redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The update method was refactored in the similar way to reduce the size of codes and improve readability. The definitions of those helper methods were placed at the bottom of the assignments_controller.rb.&lt;br /&gt;
&lt;br /&gt;
===Rename existing helper methods===&lt;br /&gt;
Actions: rename for consistent Ruby code style&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  is_due_date_nameurl_notempty → due_date_nameurl_notempty?&lt;br /&gt;
  is_meta_review_allowed? → meta_review_allowed?&lt;br /&gt;
  is_drop_topic_allowed? → drop_topic_allowed? &lt;br /&gt;
  is_signup_allowed? → signup_allowed?&lt;br /&gt;
  is_team_formation_allowed? → team_formation_allowed?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After each refactoring procedure, we perform the testing to ensure the expected functionality in Rspec. For more cases, please check our GitHub project repo. The files we make change on are: app/controllers/assignments_controller.rb and app/helpers/deadline_helper.rb&lt;br /&gt;
&lt;br /&gt;
==Additional Links==&lt;br /&gt;
[https://github.com/jerry-shijieli/expertiza Github project repo]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLUHiK0P0uQKLvW-_hBDdRK3x4cFn6BJ4C Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://rspec.info/documentation/ Rspec Documentation]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.betterspecs.org/ Better Specs]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation#Welcome_to_the_Expertiza_project.21 Expertiza Wiki]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza NCSU]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:adeshmu@ncsu.edu Amey Deshmukh]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:pmusyok@ncsu.edu Philip Musyoki]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110625</id>
		<title>CSC/ECE 517 Fall 2017/E1752 Refactor assignments controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110625"/>
		<updated>2017-10-28T02:39:28Z</updated>

		<summary type="html">&lt;p&gt;Sli41: reorganize section title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Expertiza is an open source webapp built on Ruby on Rails stack. It provides a platform to students with various features like peer-reviewing projects, submitting work, form teams, viewing grades etc. The project is being built and maintained by students and faculty at NCSU.&lt;br /&gt;
&lt;br /&gt;
==About Assignments Controller==&lt;br /&gt;
The file assignments_controller.rb handles the logic behind Expertiza assignments and enables the creation and managements of assignments by instructional staff. Besides regular CRUD operations, it also integrates multiple parts of the expertiza components, such as users of different authorizations and priorities, corresponding courses associated with the assignment, due date and so on. Therefore, further unit and integration tests are required to guarantee that these operations work as expected. And also refactoring on the code in this controller is needed to make it more readable and reduce the complexity at the same time. Our tasks are based on the motivations above.&lt;br /&gt;
&lt;br /&gt;
==About Software Testing==&lt;br /&gt;
Software testing is a process of examining a program or application with the intent of finding the software bugs. In software developemnt, it is usually defined as the process of validating and verifying that a software program or application or product meets the specified business and technical requirements.&lt;br /&gt;
&lt;br /&gt;
Additionaly, software is tested to:&lt;br /&gt;
* Detect and rectify and errors made during the development phase,&lt;br /&gt;
* Ensure customer satisfaction in the application,&lt;br /&gt;
* Ensure the quality of the software product and&lt;br /&gt;
* Optimize the performance of the system.&lt;br /&gt;
&lt;br /&gt;
Our project is guided by the Test-First Development principle. We write passing and failing tests for use cases of the assignment controller, and then turn to refactor the code. During the project, we implement the tests and refactor in Agile methodology with our mentor Zhewei through weekly delivery.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code. It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. &lt;br /&gt;
&lt;br /&gt;
The Expertiza project makes extensive use of RSpec to test the various components of the application. Tests of our tasks are in the code file: spec/controllers/assignments_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
===Testing actions perfomed===&lt;br /&gt;
* Creating new tests for each method, &lt;br /&gt;
* Testing the each method and making sure the tests pass.&lt;br /&gt;
&lt;br /&gt;
===Testing results===&lt;br /&gt;
All 22 tests were passed with zero failure on the final version of project code.&lt;br /&gt;
&lt;br /&gt;
==About Refactoring==&lt;br /&gt;
Refactoring of computer software or code is the process of restructuring existing software code without changing its external behavior or performance of the software application. Refactoring improves nonfunctional attributes of the software. Refactoring aids in code readability and keeps the code well maintained and easy to understand.&lt;br /&gt;
&lt;br /&gt;
===Refactoring actions perfomed===&lt;br /&gt;
* Replace magic numbers in deadline_type_id by constants with reasonable names;&lt;br /&gt;
* Formatting the code for readability and convention;&lt;br /&gt;
* Split large chunks of code in to smaller manageable chunks;&lt;br /&gt;
* Extract simpler and specific methods out of blocks of codes to remove code duplications using DRY principle;&lt;br /&gt;
* Rename existing methods with meaningful names for better readability without change on external functionality.&lt;br /&gt;
&lt;br /&gt;
===Refactor edit method===&lt;br /&gt;
Actions: code block split, method extraction and add meaningful constants&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def edit&lt;br /&gt;
    # give an error message is instructor have not set the time zone.&lt;br /&gt;
    if current_user.timezonepref.nil?&lt;br /&gt;
      flash.now[:error] = &amp;quot;You have not specified your preferred timezone yet. Please do this before you set up the deadlines.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: params[:id])&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @user = current_user&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: params[:id])&lt;br /&gt;
    @due_date_all = AssignmentDueDate.where(parent_id: params[:id])&lt;br /&gt;
    @reviewvarycheck = false&lt;br /&gt;
    @due_date_nameurl_notempty = false&lt;br /&gt;
    @due_date_nameurl_notempty_checkbox = false&lt;br /&gt;
    @metareview_allowed = false&lt;br /&gt;
    @metareview_allowed_checkbox = false&lt;br /&gt;
    @signup_allowed = false&lt;br /&gt;
    @signup_allowed_checkbox = false&lt;br /&gt;
    @drop_topic_allowed = false&lt;br /&gt;
    @drop_topic_allowed_checkbox = false&lt;br /&gt;
    @team_formation_allowed = false&lt;br /&gt;
    @team_formation_allowed_checkbox = false&lt;br /&gt;
    @participants_count = @assignment_form.assignment.participants.size&lt;br /&gt;
    @teams_count = @assignment_form.assignment.teams.size&lt;br /&gt;
&lt;br /&gt;
    if @assignment_form.assignment.staggered_deadline == true&lt;br /&gt;
      @review_rounds = @assignment_form.assignment.num_review_rounds&lt;br /&gt;
      @assignment_submission_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == 1 }&lt;br /&gt;
      @assignment_review_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == 2 }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Check if name and url in database is empty before webpage displays&lt;br /&gt;
    @due_date_all.each do |dd|&lt;br /&gt;
      @due_date_nameurl_notempty = is_due_date_nameurl_notempty(dd)&lt;br /&gt;
      @due_date_nameurl_notempty_checkbox = @due_date_nameurl_notempty&lt;br /&gt;
      @metareview_allowed = is_meta_review_allowed?(dd)&lt;br /&gt;
      @drop_topic_allowed = is_drop_topic_allowed?(dd)&lt;br /&gt;
      @signup_allowed = is_signup_allowed?(dd)&lt;br /&gt;
      @team_formation_allowed = is_team_formation_allowed?(dd)&lt;br /&gt;
&lt;br /&gt;
      if dd.due_at.present?&lt;br /&gt;
        dd.due_at = dd.due_at.to_s.in_time_zone(current_user.timezonepref)&lt;br /&gt;
      end&lt;br /&gt;
      if  @due_date_nameurl_notempty &amp;amp;&amp;amp; @due_date_nameurl_notempty_checkbox &amp;amp;&amp;amp;&lt;br /&gt;
          (@metareview_allowed || @drop_topic_allowed || @signup_allowed || @team_formation_allowed)&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires.each do |aq|&lt;br /&gt;
      unless aq.used_in_round.nil?&lt;br /&gt;
        @reviewvarycheck = 1&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @due_date_all = update_nil_dd_deadline_name(@due_date_all)&lt;br /&gt;
    @due_date_all = update_nil_dd_description_url(@due_date_all)&lt;br /&gt;
&lt;br /&gt;
    # only when instructor does not assign rubrics and in assignment edit page will show this error message.&lt;br /&gt;
    if !empty_rubrics_list.empty? &amp;amp;&amp;amp; request.original_fullpath == &amp;quot;/assignments/#{@assignment_form.assignment.id}/edit&amp;quot;&lt;br /&gt;
      rubrics_needed = needed_rubrics(empty_rubrics_list)&lt;br /&gt;
      flash.now[:error] = &amp;quot;You did not specify all the necessary rubrics. You need &amp;quot; + rubrics_needed +&lt;br /&gt;
          &amp;quot; of assignment &amp;lt;b&amp;gt;#{@assignment_form.assignment.name}&amp;lt;/b&amp;gt; before saving the assignment. You can assign rubrics &amp;lt;a id='go_to_tabs2' style='color: blue;'&amp;gt;here&amp;lt;/a&amp;gt;.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if @assignment_form.assignment.directory_path.nil? || @assignment_form.assignment.directory_path.empty?&lt;br /&gt;
      flash.now[:error] = &amp;quot;You did not specify your submission directory.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def edit&lt;br /&gt;
    current_user_timezonepref_nil_message&lt;br /&gt;
&lt;br /&gt;
    edit_params_setting&lt;br /&gt;
&lt;br /&gt;
    assignment_form_assignment_staggered_deadline?&lt;br /&gt;
&lt;br /&gt;
    @due_date_all.each do |dd|&lt;br /&gt;
      due_date_nameurl_notempty_check(dd)&lt;br /&gt;
&lt;br /&gt;
      due_date_present(dd)&lt;br /&gt;
&lt;br /&gt;
      break if due_date_validation&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    assignment_questionnaires_usage_check&lt;br /&gt;
&lt;br /&gt;
    @due_date_all = update_nil_dd_deadline_name(@due_date_all)&lt;br /&gt;
    @due_date_all = update_nil_dd_description_url(@due_date_all)&lt;br /&gt;
&lt;br /&gt;
    # only when instructor does not assign rubrics and in assignment edit page will show this error message.&lt;br /&gt;
    rubrics_not_assigned_message&lt;br /&gt;
&lt;br /&gt;
    assignment_directory_path_nonexist_message&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we first grouped the blocks of code according to their similarity of functions. Then we extracted simpler methods from each code block to make it more readable and reduce the complexity and coupling. It is obvious that after refactoring, this part is simpler and easier to maintain. In addition, we also replaced the magic numbers by constants according to the deadline type.&lt;br /&gt;
&lt;br /&gt;
===Refactor update method===&lt;br /&gt;
Actions: split long code block and extract specific methods&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    unless params.key?(:assignment_form)&lt;br /&gt;
      @assignment = Assignment.find(params[:id])&lt;br /&gt;
      @assignment.course_id = params[:course_id]&lt;br /&gt;
      if @assignment.save&lt;br /&gt;
        flash[:note] = 'The assignment was successfully saved.'&lt;br /&gt;
        redirect_to list_tree_display_index_path&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to save the assignment: #{@assignment.errors.full_messages.join(' ')}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path @assignment.id&lt;br /&gt;
      end&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @assignment_form.assignment.instructor ||= current_user&lt;br /&gt;
    params[:assignment_form][:assignment_questionnaire].reject! do |q|&lt;br /&gt;
      q[:questionnaire_id].empty?&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if current_user.timezonepref.nil?&lt;br /&gt;
      parent_id = current_user.parent_id&lt;br /&gt;
      parent_timezone = User.find(parent_id).timezonepref&lt;br /&gt;
      flash[:error] = &amp;quot;We strongly suggest that instructors specify their preferred timezone to guarantee the correct display time. For now we assume you are in &amp;quot; + parent_timezone&lt;br /&gt;
      current_user.timezonepref = parent_timezone&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment_form.update_attributes(assignment_form_params, current_user)&lt;br /&gt;
      flash[:note] = 'The assignment was successfully saved....'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = &amp;quot;Failed to save the assignment: #{@assignment_form.errors.get(:message)}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    unless params.key?(:assignment_form)&lt;br /&gt;
      assignment_form_key_nonexist_case_handler&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    assignment_form_retrieval&lt;br /&gt;
&lt;br /&gt;
    current_user_timezonepref_nil_handler&lt;br /&gt;
&lt;br /&gt;
    assignment_form_update_attributes_message&lt;br /&gt;
&lt;br /&gt;
    redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The update method was refactored in the similar way to reduce the size of codes and improve readability. The definitions of those helper methods were placed at the bottom of the assignments_controller.rb.&lt;br /&gt;
&lt;br /&gt;
===Rename existing helper methods===&lt;br /&gt;
Actions: rename for consistent Ruby code style&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  is_due_date_nameurl_notempty → due_date_nameurl_notempty?&lt;br /&gt;
  is_meta_review_allowed? → meta_review_allowed?&lt;br /&gt;
  is_drop_topic_allowed? → drop_topic_allowed? &lt;br /&gt;
  is_signup_allowed? → signup_allowed?&lt;br /&gt;
  is_team_formation_allowed? → team_formation_allowed?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After each refactoring procedure, we perform the testing to ensure the expected functionality in Rspec. For more cases, please check our GitHub project repo. The files we make change on are: app/controllers/assignments_controller.rb and app/helpers/deadline_helper.rb&lt;br /&gt;
&lt;br /&gt;
==Additional Links==&lt;br /&gt;
[https://github.com/jerry-shijieli/expertiza Github project repo]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLUHiK0P0uQKLvW-_hBDdRK3x4cFn6BJ4C Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://rspec.info/documentation/ Rspec Documentation]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.betterspecs.org/ Better Specs]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation#Welcome_to_the_Expertiza_project.21 Expertiza Wiki]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza NCSU]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:adeshmu@ncsu.edu Amey Deshmukh]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:pmusyok@ncsu.edu Philip Musyoki]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110614</id>
		<title>CSC/ECE 517 Fall 2017/E1752 Refactor assignments controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110614"/>
		<updated>2017-10-28T02:31:31Z</updated>

		<summary type="html">&lt;p&gt;Sli41: add details about edit, update refactoring and helper method renaming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Expertiza is an open source webapp built on Ruby on Rails stack. It provides a platform to students with various features like peer-reviewing projects, submitting work, form teams, viewing grades etc. The project is being built and maintained by students and faculty at NCSU.&lt;br /&gt;
&lt;br /&gt;
==About Assignments Controller==&lt;br /&gt;
The file assignments_controller.rb handles the logic behind Expertiza assignments and enables the creation and managements of assignments by instructional staff. Besides regular CRUD operations, it also integrates multiple parts of the expertiza components, such as users of different authorizations and priorities, corresponding courses associated with the assignment, due date and so on. Therefore, further unit and integration tests are required to guarantee that these operations work as expected. And also refactoring on the code in this controller is needed to make it more readable and reduce the complexity at the same time. Our tasks are based on the motivations above.&lt;br /&gt;
&lt;br /&gt;
==About Software Testing==&lt;br /&gt;
Software testing is a process of examining a program or application with the intent of finding the software bugs. In software developemnt, it is usually defined as the process of validating and verifying that a software program or application or product meets the specified business and technical requirements.&lt;br /&gt;
&lt;br /&gt;
Additionaly, software is tested to:&lt;br /&gt;
* Detect and rectify and errors made during the development phase,&lt;br /&gt;
* Ensure customer satisfaction in the application,&lt;br /&gt;
* Ensure the quality of the software product and&lt;br /&gt;
* Optimize the performance of the system.&lt;br /&gt;
&lt;br /&gt;
Our project is guided by the Test-First Development principle. We write passing and failing tests for use cases of the assignment controller, and then turn to refactor the code. During the project, we implement the tests and refactor in Agile methodology with our mentor Zhewei through weekly delivery.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code. It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. &lt;br /&gt;
&lt;br /&gt;
The Expertiza project makes extensive use of RSpec to test the various components of the application. Tests of our tasks are in the code file: spec/controllers/assignments_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
===Testing actions perfomed===&lt;br /&gt;
* Creating new tests for each method, &lt;br /&gt;
* Testing the each method and making sure the tests pass.&lt;br /&gt;
&lt;br /&gt;
==About Refactoring==&lt;br /&gt;
Refactoring of computer software or code is the process of restructuring existing software code without changing its external behavior or performance of the software application. Refactoring improves nonfunctional attributes of the software. Refactoring aids in code readability and keeps the code well maintained and easy to understand.&lt;br /&gt;
&lt;br /&gt;
===Refactoring actions perfomed===&lt;br /&gt;
* Replace magic numbers in deadline_type_id by constants with reasonable names;&lt;br /&gt;
* Formatting the code for readability and convention;&lt;br /&gt;
* Split large chunks of code in to smaller manageable chunks;&lt;br /&gt;
* Extract simpler and specific methods out of blocks of codes to remove code duplications using DRY principle;&lt;br /&gt;
* Rename existing methods with meaningful names for better readability without change on external functionality.&lt;br /&gt;
&lt;br /&gt;
====Refactor edit method: code block split, method extraction and new constants====&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def edit&lt;br /&gt;
    # give an error message is instructor have not set the time zone.&lt;br /&gt;
    if current_user.timezonepref.nil?&lt;br /&gt;
      flash.now[:error] = &amp;quot;You have not specified your preferred timezone yet. Please do this before you set up the deadlines.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    @topics = SignUpTopic.where(assignment_id: params[:id])&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @user = current_user&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: params[:id])&lt;br /&gt;
    @due_date_all = AssignmentDueDate.where(parent_id: params[:id])&lt;br /&gt;
    @reviewvarycheck = false&lt;br /&gt;
    @due_date_nameurl_notempty = false&lt;br /&gt;
    @due_date_nameurl_notempty_checkbox = false&lt;br /&gt;
    @metareview_allowed = false&lt;br /&gt;
    @metareview_allowed_checkbox = false&lt;br /&gt;
    @signup_allowed = false&lt;br /&gt;
    @signup_allowed_checkbox = false&lt;br /&gt;
    @drop_topic_allowed = false&lt;br /&gt;
    @drop_topic_allowed_checkbox = false&lt;br /&gt;
    @team_formation_allowed = false&lt;br /&gt;
    @team_formation_allowed_checkbox = false&lt;br /&gt;
    @participants_count = @assignment_form.assignment.participants.size&lt;br /&gt;
    @teams_count = @assignment_form.assignment.teams.size&lt;br /&gt;
&lt;br /&gt;
    if @assignment_form.assignment.staggered_deadline == true&lt;br /&gt;
      @review_rounds = @assignment_form.assignment.num_review_rounds&lt;br /&gt;
      @assignment_submission_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == 1 }&lt;br /&gt;
      @assignment_review_due_dates = @due_date_all.select {|due_date| due_date.deadline_type_id == 2 }&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Check if name and url in database is empty before webpage displays&lt;br /&gt;
    @due_date_all.each do |dd|&lt;br /&gt;
      @due_date_nameurl_notempty = is_due_date_nameurl_notempty(dd)&lt;br /&gt;
      @due_date_nameurl_notempty_checkbox = @due_date_nameurl_notempty&lt;br /&gt;
      @metareview_allowed = is_meta_review_allowed?(dd)&lt;br /&gt;
      @drop_topic_allowed = is_drop_topic_allowed?(dd)&lt;br /&gt;
      @signup_allowed = is_signup_allowed?(dd)&lt;br /&gt;
      @team_formation_allowed = is_team_formation_allowed?(dd)&lt;br /&gt;
&lt;br /&gt;
      if dd.due_at.present?&lt;br /&gt;
        dd.due_at = dd.due_at.to_s.in_time_zone(current_user.timezonepref)&lt;br /&gt;
      end&lt;br /&gt;
      if  @due_date_nameurl_notempty &amp;amp;&amp;amp; @due_date_nameurl_notempty_checkbox &amp;amp;&amp;amp;&lt;br /&gt;
          (@metareview_allowed || @drop_topic_allowed || @signup_allowed || @team_formation_allowed)&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @assignment_questionnaires.each do |aq|&lt;br /&gt;
      unless aq.used_in_round.nil?&lt;br /&gt;
        @reviewvarycheck = 1&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
    @due_date_all = update_nil_dd_deadline_name(@due_date_all)&lt;br /&gt;
    @due_date_all = update_nil_dd_description_url(@due_date_all)&lt;br /&gt;
&lt;br /&gt;
    # only when instructor does not assign rubrics and in assignment edit page will show this error message.&lt;br /&gt;
    if !empty_rubrics_list.empty? &amp;amp;&amp;amp; request.original_fullpath == &amp;quot;/assignments/#{@assignment_form.assignment.id}/edit&amp;quot;&lt;br /&gt;
      rubrics_needed = needed_rubrics(empty_rubrics_list)&lt;br /&gt;
      flash.now[:error] = &amp;quot;You did not specify all the necessary rubrics. You need &amp;quot; + rubrics_needed +&lt;br /&gt;
          &amp;quot; of assignment &amp;lt;b&amp;gt;#{@assignment_form.assignment.name}&amp;lt;/b&amp;gt; before saving the assignment. You can assign rubrics &amp;lt;a id='go_to_tabs2' style='color: blue;'&amp;gt;here&amp;lt;/a&amp;gt;.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if @assignment_form.assignment.directory_path.nil? || @assignment_form.assignment.directory_path.empty?&lt;br /&gt;
      flash.now[:error] = &amp;quot;You did not specify your submission directory.&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def edit&lt;br /&gt;
    current_user_timezonepref_nil_message&lt;br /&gt;
&lt;br /&gt;
    edit_params_setting&lt;br /&gt;
&lt;br /&gt;
    assignment_form_assignment_staggered_deadline?&lt;br /&gt;
&lt;br /&gt;
    @due_date_all.each do |dd|&lt;br /&gt;
      due_date_nameurl_notempty_check(dd)&lt;br /&gt;
&lt;br /&gt;
      due_date_present(dd)&lt;br /&gt;
&lt;br /&gt;
      break if due_date_validation&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    assignment_questionnaires_usage_check&lt;br /&gt;
&lt;br /&gt;
    @due_date_all = update_nil_dd_deadline_name(@due_date_all)&lt;br /&gt;
    @due_date_all = update_nil_dd_description_url(@due_date_all)&lt;br /&gt;
&lt;br /&gt;
    # only when instructor does not assign rubrics and in assignment edit page will show this error message.&lt;br /&gt;
    rubrics_not_assigned_message&lt;br /&gt;
&lt;br /&gt;
    assignment_directory_path_nonexist_message&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we first grouped the blocks of code according to their similarity of functions. Then we extracted simpler methods from each code block to make it more readable and reduce the complexity and coupling. It is obvious that after refactoring, this part is simpler and easier to maintain. In addition, we also replaced the magic numbers by constants according to the deadline type.&lt;br /&gt;
&lt;br /&gt;
====Refactor update method: split long code block and extract specific methods====&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    unless params.key?(:assignment_form)&lt;br /&gt;
      @assignment = Assignment.find(params[:id])&lt;br /&gt;
      @assignment.course_id = params[:course_id]&lt;br /&gt;
      if @assignment.save&lt;br /&gt;
        flash[:note] = 'The assignment was successfully saved.'&lt;br /&gt;
        redirect_to list_tree_display_index_path&lt;br /&gt;
      else&lt;br /&gt;
        flash[:error] = &amp;quot;Failed to save the assignment: #{@assignment.errors.full_messages.join(' ')}&amp;quot;&lt;br /&gt;
        redirect_to edit_assignment_path @assignment.id&lt;br /&gt;
      end&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    @assignment_form = AssignmentForm.create_form_object(params[:id])&lt;br /&gt;
    @assignment_form.assignment.instructor ||= current_user&lt;br /&gt;
    params[:assignment_form][:assignment_questionnaire].reject! do |q|&lt;br /&gt;
      q[:questionnaire_id].empty?&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if current_user.timezonepref.nil?&lt;br /&gt;
      parent_id = current_user.parent_id&lt;br /&gt;
      parent_timezone = User.find(parent_id).timezonepref&lt;br /&gt;
      flash[:error] = &amp;quot;We strongly suggest that instructors specify their preferred timezone to guarantee the correct display time. For now we assume you are in &amp;quot; + parent_timezone&lt;br /&gt;
      current_user.timezonepref = parent_timezone&lt;br /&gt;
    end&lt;br /&gt;
    if @assignment_form.update_attributes(assignment_form_params, current_user)&lt;br /&gt;
      flash[:note] = 'The assignment was successfully saved....'&lt;br /&gt;
    else&lt;br /&gt;
      flash[:error] = &amp;quot;Failed to save the assignment: #{@assignment_form.errors.get(:message)}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  def update&lt;br /&gt;
    unless params.key?(:assignment_form)&lt;br /&gt;
      assignment_form_key_nonexist_case_handler&lt;br /&gt;
      return&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    assignment_form_retrieval&lt;br /&gt;
&lt;br /&gt;
    current_user_timezonepref_nil_handler&lt;br /&gt;
&lt;br /&gt;
    assignment_form_update_attributes_message&lt;br /&gt;
&lt;br /&gt;
    redirect_to edit_assignment_path @assignment_form.assignment.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The update method was refactored in the similar way to reduce the size of codes and improve readability. The definitions of those helper methods were placed at the bottom of the assignments_controller.rb.&lt;br /&gt;
&lt;br /&gt;
====Rename existing helper methods: consistent with Ruby code style====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  is_due_date_nameurl_notempty → due_date_nameurl_notempty?&lt;br /&gt;
  is_meta_review_allowed? → meta_review_allowed?&lt;br /&gt;
  is_drop_topic_allowed? → drop_topic_allowed? &lt;br /&gt;
  is_signup_allowed? → signup_allowed?&lt;br /&gt;
  is_team_formation_allowed? → team_formation_allowed?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After each refactoring procedure, we perform the testing to ensure the expected functionality in Rspec. For more cases, please check our GitHub project repo. The files we make change on are: app/controllers/assignments_controller.rb and app/helpers/deadline_helper.rb&lt;br /&gt;
&lt;br /&gt;
==Additional Links==&lt;br /&gt;
[https://github.com/jerry-shijieli/expertiza Github project repo]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLUHiK0P0uQKLvW-_hBDdRK3x4cFn6BJ4C Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://rspec.info/documentation/ Rspec Documentation]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.betterspecs.org/ Better Specs]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation#Welcome_to_the_Expertiza_project.21 Expertiza Wiki]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza NCSU]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:adeshmu@ncsu.edu Amey Deshmukh]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:pmusyok@ncsu.edu Philip Musyoki]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110543</id>
		<title>CSC/ECE 517 Fall 2017/E1752 Refactor assignments controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110543"/>
		<updated>2017-10-28T01:17:24Z</updated>

		<summary type="html">&lt;p&gt;Sli41: add constant part&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Expertiza is an open source webapp built on Ruby on Rails stack. It provides a platform to students with various features like peer-reviewing projects, submitting work, form teams, viewing grades etc. The project is being built and maintained by students and faculty at NCSU.&lt;br /&gt;
&lt;br /&gt;
==About Assignments Controller==&lt;br /&gt;
The file assignments_controller.rb handles the logic behind Expertiza assignments and enables the creation and managements of assignments by instructional staff. Besides regular CRUD operations, it also integrates multiple parts of the expertiza components, such as users of different authorizations and priorities, corresponding courses associated with the assignment, due date and so on. Therefore, further unit and integration tests are required to guarantee that these operations work as expected. And also refactoring on the code in this controller is needed to make it more readable and reduce the complexity at the same time. Our tasks are based on the motivations above.&lt;br /&gt;
&lt;br /&gt;
==About Software Testing==&lt;br /&gt;
Software testing is a process of examining a program or application with the intent of finding the software bugs. In software developemnt, it is usually defined as the process of validating and verifying that a software program or application or product meets the specified business and technical requirements.&lt;br /&gt;
&lt;br /&gt;
Additionaly, software is tested to:&lt;br /&gt;
* Detect and rectify and errors made during the development phase,&lt;br /&gt;
* Ensure customer satisfaction in the application,&lt;br /&gt;
* Ensure the quality of the software product and&lt;br /&gt;
* Optimize the performance of the system.&lt;br /&gt;
&lt;br /&gt;
Our project is guided by the Test-First Development principle. We write passing and failing tests for use cases of the assignment controller, and then turn to refactor the code. During the project, we implement the tests and refactor in Agile methodology with our mentor Zhewei through weekly delivery.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code. It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. &lt;br /&gt;
&lt;br /&gt;
The Expertiza project makes extensive use of RSpec to test the various components of the application. Tests of our tasks are in the code file: spec/controllers/assignments_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
===Testing actions perfomed===&lt;br /&gt;
* Creating new tests for each method, &lt;br /&gt;
* Testing the each method and making sure the tests pass.&lt;br /&gt;
&lt;br /&gt;
==About Refactoring==&lt;br /&gt;
Refactoring of computer software or code is the process of restructuring existing software code without changing its external behavior or performance of the software application. Refactoring improves nonfunctional attributes of the software. Refactoring aids in code readability and keeps the code well maintained and easy to understand.&lt;br /&gt;
&lt;br /&gt;
===Refactoring actions perfomed===&lt;br /&gt;
* Replace magic numbers in deadline_type_id by constants with reasonable names;&lt;br /&gt;
* Formatting the code for readability and convention;&lt;br /&gt;
* Split large chunks of code in to smaller manageable chunks;&lt;br /&gt;
* Extract simpler and specific methods out of blocks of codes to remove code duplications using DRY principle;&lt;br /&gt;
* Rename existing methods with meaningful names for better readability without change on external functionality.&lt;br /&gt;
&lt;br /&gt;
Example: code block split and method extraction&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
      @due_date_nameurl_notempty = is_due_date_nameurl_notempty(dd)&lt;br /&gt;
      @due_date_nameurl_notempty_checkbox = @due_date_nameurl_notempty&lt;br /&gt;
      @metareview_allowed = is_meta_review_allowed?(dd)&lt;br /&gt;
      @drop_topic_allowed = is_drop_topic_allowed?(dd)&lt;br /&gt;
      @signup_allowed = is_signup_allowed?(dd)&lt;br /&gt;
      @team_formation_allowed = is_team_formation_allowed?(dd)&lt;br /&gt;
      if dd.due_at.present?&lt;br /&gt;
        dd.due_at = dd.due_at.to_s.in_time_zone(current_user.timezonepref)&lt;br /&gt;
      end&lt;br /&gt;
      if  @due_date_nameurl_notempty &amp;amp;&amp;amp; @due_date_nameurl_notempty_checkbox &amp;amp;&amp;amp;&lt;br /&gt;
          (@metareview_allowed || @drop_topic_allowed || @signup_allowed || @team_formation_allowed)&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
    &lt;br /&gt;
      due_date_nameurl_notempty_check(dd)&lt;br /&gt;
&lt;br /&gt;
      due_date_present(dd)&lt;br /&gt;
&lt;br /&gt;
      if due_date_validation&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It is obvious that after refactoring, this part is simpler and easier to maintain. After each refactoring procedure, we perform the testing to ensure the expected functionality in Rspec. For more cases, please check our GitHub project repo. The files we make change on are: app/controllers/assignments_controller.rb and app/helpers/deadline_helper.rb&lt;br /&gt;
&lt;br /&gt;
==Additional Links==&lt;br /&gt;
[https://github.com/jerry-shijieli/expertiza Github project repo]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLUHiK0P0uQKLvW-_hBDdRK3x4cFn6BJ4C Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://rspec.info/documentation/ Rspec Documentation]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.betterspecs.org/ Better Specs]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation#Welcome_to_the_Expertiza_project.21 Expertiza Wiki]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza NCSU]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:adeshmu@ncsu.edu Amey Deshmukh]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:pmusyok@ncsu.edu Philip Musyoki]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110432</id>
		<title>CSC/ECE 517 Fall 2017/E1752 Refactor assignments controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110432"/>
		<updated>2017-10-28T00:05:43Z</updated>

		<summary type="html">&lt;p&gt;Sli41: update refactor&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Expertiza is an open source webapp built on Ruby on Rails stack. It provides a platform to students with various features like peer-reviewing projects, submitting work, form teams, viewing grades etc. The project is being built and maintained by students and faculty at NCSU.&lt;br /&gt;
&lt;br /&gt;
==About Assignments Controller==&lt;br /&gt;
The file assignments_controller.rb handles the logic behind Expertiza assignments and enables the creation and managements of assignments by instructional staff. Besides regular CRUD operations, it also integrates multiple parts of the expertiza components, such as users of different authorizations and priorities, corresponding courses associated with the assignment, due date and so on. Therefore, further unit and integration tests are required to guarantee that these operations work as expected. And also refactoring on the code in this controller is needed to make it more readable and reduce the complexity at the same time. Our tasks are based on the motivations above.&lt;br /&gt;
&lt;br /&gt;
==About Software Testing==&lt;br /&gt;
Software testing is a process of examining a program or application with the intent of finding the software bugs. In software developemnt, it is usually defined as the process of validating and verifying that a software program or application or product meets the specified business and technical requirements.&lt;br /&gt;
&lt;br /&gt;
Additionaly, software is tested to:&lt;br /&gt;
* Detect and rectify and errors made during the development phase,&lt;br /&gt;
* Ensure customer satisfaction in the application,&lt;br /&gt;
* Ensure the quality of the software product and&lt;br /&gt;
* Optimize the performance of the system.&lt;br /&gt;
&lt;br /&gt;
Our project is guided by the Test-First Development principle. We write passing and failing tests for use cases of the assignment controller, and then turn to refactor the code. During the project, we implement the tests and refactor in Agile methodology with our mentor Zhewei through weekly delivery.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code. It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. &lt;br /&gt;
&lt;br /&gt;
The Expertiza project makes extensive use of RSpec to test the various components of the application.&lt;br /&gt;
&lt;br /&gt;
===Testing actions perfomed===&lt;br /&gt;
* Creating new tests for each method, &lt;br /&gt;
* Testing the each method and making sure the tests pass.&lt;br /&gt;
&lt;br /&gt;
==About Refactoring==&lt;br /&gt;
Refactoring of computer software or code is the process of restructuring existing software code without changing its external behavior or performance of the software application. Refactoring improves nonfunctional attributes of the software. Refactoring aids in code readability and keeps the code well maintained and easy to understand.&lt;br /&gt;
&lt;br /&gt;
===Refactoring actions perfomed===&lt;br /&gt;
* Formatting the code for readability and convention;&lt;br /&gt;
* Split large chunks of code in to smaller manageable chunks;&lt;br /&gt;
* Extract simpler and specific methods out of blocks of codes to remove code duplications using DRY principle;&lt;br /&gt;
* Rename existing methods with meaningful names for better readability without change on external functionality.&lt;br /&gt;
&lt;br /&gt;
Example: code block split and method extraction&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
      @due_date_nameurl_notempty = is_due_date_nameurl_notempty(dd)&lt;br /&gt;
      @due_date_nameurl_notempty_checkbox = @due_date_nameurl_notempty&lt;br /&gt;
      @metareview_allowed = is_meta_review_allowed?(dd)&lt;br /&gt;
      @drop_topic_allowed = is_drop_topic_allowed?(dd)&lt;br /&gt;
      @signup_allowed = is_signup_allowed?(dd)&lt;br /&gt;
      @team_formation_allowed = is_team_formation_allowed?(dd)&lt;br /&gt;
      if dd.due_at.present?&lt;br /&gt;
        dd.due_at = dd.due_at.to_s.in_time_zone(current_user.timezonepref)&lt;br /&gt;
      end&lt;br /&gt;
      if  @due_date_nameurl_notempty &amp;amp;&amp;amp; @due_date_nameurl_notempty_checkbox &amp;amp;&amp;amp;&lt;br /&gt;
          (@metareview_allowed || @drop_topic_allowed || @signup_allowed || @team_formation_allowed)&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
    &lt;br /&gt;
      due_date_nameurl_notempty_check(dd)&lt;br /&gt;
&lt;br /&gt;
      due_date_present(dd)&lt;br /&gt;
&lt;br /&gt;
      if due_date_validation&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It is obvious that after refactoring, this part is simpler and easier to maintain. After each refactoring procedure, we perform the testing to ensure the expected functionality in Rspec. For more cases, please check our GitHub project repo.&lt;br /&gt;
&lt;br /&gt;
==Additional Links==&lt;br /&gt;
[https://github.com/jerry-shijieli/expertiza Github project repo]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLUHiK0P0uQKLvW-_hBDdRK3x4cFn6BJ4C Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://rspec.info/documentation/ Rspec Documentation]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.betterspecs.org/ Better Specs]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation#Welcome_to_the_Expertiza_project.21 Expertiza Wiki]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza NCSU]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:adeshmu@ncsu.edu Amey Deshmukh]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:pmusyok@ncsu.edu Philip Musyoki]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110430</id>
		<title>CSC/ECE 517 Fall 2017/E1752 Refactor assignments controller</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1752_Refactor_assignments_controller&amp;diff=110430"/>
		<updated>2017-10-28T00:04:21Z</updated>

		<summary type="html">&lt;p&gt;Sli41: add example to refactoring&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Expertiza is an open source webapp built on Ruby on Rails stack. It provides a platform to students with various features like peer-reviewing projects, submitting work, form teams, viewing grades etc. The project is being built and maintained by students and faculty at NCSU.&lt;br /&gt;
&lt;br /&gt;
==About Assignments Controller==&lt;br /&gt;
The file assignments_controller.rb handles the logic behind Expertiza assignments and enables the creation and managements of assignments by instructional staff. Besides regular CRUD operations, it also integrates multiple parts of the expertiza components, such as users of different authorizations and priorities, corresponding courses associated with the assignment, due date and so on. Therefore, further unit and integration tests are required to guarantee that these operations work as expected. And also refactoring on the code in this controller is needed to make it more readable and reduce the complexity at the same time. Our tasks are based on the motivations above.&lt;br /&gt;
&lt;br /&gt;
==About Software Testing==&lt;br /&gt;
Software testing is a process of examining a program or application with the intent of finding the software bugs. In software developemnt, it is usually defined as the process of validating and verifying that a software program or application or product meets the specified business and technical requirements.&lt;br /&gt;
&lt;br /&gt;
Additionaly, software is tested to:&lt;br /&gt;
* Detect and rectify and errors made during the development phase,&lt;br /&gt;
* Ensure customer satisfaction in the application,&lt;br /&gt;
* Ensure the quality of the software product and&lt;br /&gt;
* Optimize the performance of the system.&lt;br /&gt;
&lt;br /&gt;
Our project is guided by the Test-First Development principle. We write passing and failing tests for use cases of the assignment controller, and then turn to refactor the code. During the project, we implement the tests and refactor in Agile methodology with our mentor Zhewei through weekly delivery.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
RSpec is a 'Domain Specific Language' (DSL) testing tool written in Ruby to test Ruby code. It is a behavior-driven development (BDD) framework which is extensively used in the production applications. The basic idea behind this concept is that of Test Driven Development(TDD) where the tests are written first and the development is based on writing just enough code that will fulfill those tests followed by refactoring. &lt;br /&gt;
&lt;br /&gt;
The Expertiza project makes extensive use of RSpec to test the various components of the application.&lt;br /&gt;
&lt;br /&gt;
===Testing actions perfomed===&lt;br /&gt;
* Creating new tests for each method, &lt;br /&gt;
* Testing the each method and making sure the tests pass.&lt;br /&gt;
&lt;br /&gt;
==About Refactoring==&lt;br /&gt;
Refactoring of computer software or code is the process of restructuring existing software code without changing its external behavior or performance of the software application. Refactoring improves nonfunctional attributes of the software. Refactoring aids in code readability and keeps the code well maintained and easy to understand.&lt;br /&gt;
&lt;br /&gt;
===Refactoring actions perfomed===&lt;br /&gt;
* Formatting the code for readability and convention;&lt;br /&gt;
* Split large chunks of code in to smaller manageable chunks;&lt;br /&gt;
* Extract simpler and specific methods out of blocks of codes to remove code duplications using DRY principle;&lt;br /&gt;
* Rename existing methods with meaningful names for better readability without change on external functionality.&lt;br /&gt;
&lt;br /&gt;
Example: code block split and method extraction&lt;br /&gt;
&lt;br /&gt;
Original&lt;br /&gt;
&lt;br /&gt;
      @due_date_nameurl_notempty = is_due_date_nameurl_notempty(dd)&lt;br /&gt;
      @due_date_nameurl_notempty_checkbox = @due_date_nameurl_notempty&lt;br /&gt;
      @metareview_allowed = is_meta_review_allowed?(dd)&lt;br /&gt;
      @drop_topic_allowed = is_drop_topic_allowed?(dd)&lt;br /&gt;
      @signup_allowed = is_signup_allowed?(dd)&lt;br /&gt;
      @team_formation_allowed = is_team_formation_allowed?(dd)&lt;br /&gt;
      if dd.due_at.present?&lt;br /&gt;
        dd.due_at = dd.due_at.to_s.in_time_zone(current_user.timezonepref)&lt;br /&gt;
      end&lt;br /&gt;
      if  @due_date_nameurl_notempty &amp;amp;&amp;amp; @due_date_nameurl_notempty_checkbox &amp;amp;&amp;amp;&lt;br /&gt;
          (@metareview_allowed || @drop_topic_allowed || @signup_allowed || @team_formation_allowed)&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
After refactoring&lt;br /&gt;
    &lt;br /&gt;
      due_date_nameurl_notempty_check(dd)&lt;br /&gt;
&lt;br /&gt;
      due_date_present(dd)&lt;br /&gt;
&lt;br /&gt;
      if due_date_validation&lt;br /&gt;
        break&lt;br /&gt;
      end&lt;br /&gt;
&lt;br /&gt;
It is obvious that after refactoring, this part is simpler and easier to maintain. After each refactoring procedure, we perform the testing to ensure the expected functionality in Rspec.&lt;br /&gt;
&lt;br /&gt;
==Additional Links==&lt;br /&gt;
[https://github.com/jerry-shijieli/expertiza Github project repo]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLUHiK0P0uQKLvW-_hBDdRK3x4cFn6BJ4C Project Video Demo]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
[http://rspec.info/documentation/ Rspec Documentation]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.betterspecs.org/ Better Specs]&amp;lt;br&amp;gt;&lt;br /&gt;
[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation#Welcome_to_the_Expertiza_project.21 Expertiza Wiki]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://expertiza.ncsu.edu/ Expertiza NCSU]&lt;br /&gt;
&lt;br /&gt;
==Team==&lt;br /&gt;
[mailto:sli41@ncsu.edu Shijie Li]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:adeshmu@ncsu.edu Amey Deshmukh]&amp;lt;br&amp;gt;&lt;br /&gt;
[mailto:pmusyok@ncsu.edu Philip Musyoki]&lt;/div&gt;</summary>
		<author><name>Sli41</name></author>
	</entry>
</feed>