<?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=Skatta3</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=Skatta3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Skatta3"/>
	<updated>2026-06-23T18:51:15Z</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/E1797_Timestamps_for_students_submission&amp;diff=114502</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114502"/>
		<updated>2017-12-06T11:33:22Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currently there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img1.png]]&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about 1 year in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='  ')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file was created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
We have written tests for 3 scenarios&lt;br /&gt;
* '''Scenario 1: Testing whether deadlines are visible on the graph:'''&lt;br /&gt;
We created a dummy assignment with associated deadline in “before” statement. The code for that is:&lt;br /&gt;
&lt;br /&gt;
 before(:each) do&lt;br /&gt;
    create(:assignment, name: &amp;quot;E1797-Test&amp;quot;, directory_path: 'test_assignment')&lt;br /&gt;
    create_list(:participant, 3)&lt;br /&gt;
    create(:assignment_node)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: '2200-12-23 03:33:23')&lt;br /&gt;
    login_as(&amp;quot;student2065&amp;quot;)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Then, in the test case we tested whether the deadline is present on the graph.&lt;br /&gt;
The RSpec Feature testing code is :&lt;br /&gt;
  &lt;br /&gt;
 it 'displays review due dates along with its timestamps' do&lt;br /&gt;
   #checks whether the UI has above given deadline&lt;br /&gt;
   page.html.should include('2200-12-23 03:33:23')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 2: Testing whether submitted linked is visible on the graph:'''&lt;br /&gt;
Since we already created a assignment in the “before” statement In this particular test case, we submitted the work for an assignment in “Your Work” tab and checked whether this link is present in the graph. The RSpec code is as follows:&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted hyperlink along with timestamp' do&lt;br /&gt;
   #submit a generic link for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   fill_in &amp;quot;submission&amp;quot;, with: &amp;quot;http: //www.google.com&amp;quot;&lt;br /&gt;
   click_button &amp;quot;Upload link&amp;quot;&lt;br /&gt;
   #expect the same link to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('https: //www.google.com')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 3: Testing whether submitted file is visible on the graph:'''&lt;br /&gt;
In this particular test case a file as submission for an assignment was uploaded. After this. it is checked whether this file is present in the graph.&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted file along with timestamp' do&lt;br /&gt;
   #submit a generic file for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   file_path = Rails.root + &amp;quot;spec/features/timestamp_students_submissions_spec.rb&amp;quot;&lt;br /&gt;
   attach_file('uploaded_file', file_path)&lt;br /&gt;
   click_on 'Upload file'&lt;br /&gt;
   #expect the same file to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('timestamp_students_submissions_spec.rb')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no topic name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes topics in assignment are not named(eg program 2 - car rental app). In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [topic name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/1126 Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114501</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114501"/>
		<updated>2017-12-06T11:12:03Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Edge Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currently there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img1.png]]&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about 1 year in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='  ')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file was created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
We have written tests for 3 scenarios&lt;br /&gt;
* '''Scenario 1: Testing whether deadlines are visible on the graph:'''&lt;br /&gt;
We created a dummy assignment with associated deadline in “before” statement. The code for that is:&lt;br /&gt;
&lt;br /&gt;
 before(:each) do&lt;br /&gt;
    create(:assignment, name: &amp;quot;E1797-Test&amp;quot;, directory_path: 'test_assignment')&lt;br /&gt;
    create_list(:participant, 3)&lt;br /&gt;
    create(:assignment_node)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: '2200-12-23 03:33:23')&lt;br /&gt;
    login_as(&amp;quot;student2065&amp;quot;)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Then, in the test case we tested whether the deadline is present on the graph.&lt;br /&gt;
The RSpec Feature testing code is :&lt;br /&gt;
  &lt;br /&gt;
 it 'displays review due dates along with its timestamps' do&lt;br /&gt;
   #checks whether the UI has above given deadline&lt;br /&gt;
   page.html.should include('2200-12-23 03:33:23')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 2: Testing whether submitted linked is visible on the graph:'''&lt;br /&gt;
Since we already created a assignment in the “before” statement In this particular test case, we submitted the work for an assignment in “Your Work” tab and checked whether this link is present in the graph. The RSpec code is as follows:&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted hyperlink along with timestamp' do&lt;br /&gt;
   #submit a generic link for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   fill_in &amp;quot;submission&amp;quot;, with: &amp;quot;http: //www.google.com&amp;quot;&lt;br /&gt;
   click_button &amp;quot;Upload link&amp;quot;&lt;br /&gt;
   #expect the same link to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('https: //www.google.com')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 3: Testing whether submitted file is visible on the graph:'''&lt;br /&gt;
In this particular test case a file as submission for an assignment was uploaded. After this. it is checked whether this file is present in the graph.&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted file along with timestamp' do&lt;br /&gt;
   #submit a generic file for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   file_path = Rails.root + &amp;quot;spec/features/timestamp_students_submissions_spec.rb&amp;quot;&lt;br /&gt;
   attach_file('uploaded_file', file_path)&lt;br /&gt;
   click_on 'Upload file'&lt;br /&gt;
   #expect the same file to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('timestamp_students_submissions_spec.rb')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no topic name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes topics in assignment are not named(eg program 2 - car rental app). In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [topic name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114500</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114500"/>
		<updated>2017-12-06T11:11:36Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Edge Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currently there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img1.png]]&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about 1 year in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='  ')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file was created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
We have written tests for 3 scenarios&lt;br /&gt;
* '''Scenario 1: Testing whether deadlines are visible on the graph:'''&lt;br /&gt;
We created a dummy assignment with associated deadline in “before” statement. The code for that is:&lt;br /&gt;
&lt;br /&gt;
 before(:each) do&lt;br /&gt;
    create(:assignment, name: &amp;quot;E1797-Test&amp;quot;, directory_path: 'test_assignment')&lt;br /&gt;
    create_list(:participant, 3)&lt;br /&gt;
    create(:assignment_node)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: '2200-12-23 03:33:23')&lt;br /&gt;
    login_as(&amp;quot;student2065&amp;quot;)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Then, in the test case we tested whether the deadline is present on the graph.&lt;br /&gt;
The RSpec Feature testing code is :&lt;br /&gt;
  &lt;br /&gt;
 it 'displays review due dates along with its timestamps' do&lt;br /&gt;
   #checks whether the UI has above given deadline&lt;br /&gt;
   page.html.should include('2200-12-23 03:33:23')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 2: Testing whether submitted linked is visible on the graph:'''&lt;br /&gt;
Since we already created a assignment in the “before” statement In this particular test case, we submitted the work for an assignment in “Your Work” tab and checked whether this link is present in the graph. The RSpec code is as follows:&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted hyperlink along with timestamp' do&lt;br /&gt;
   #submit a generic link for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   fill_in &amp;quot;submission&amp;quot;, with: &amp;quot;http: //www.google.com&amp;quot;&lt;br /&gt;
   click_button &amp;quot;Upload link&amp;quot;&lt;br /&gt;
   #expect the same link to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('https: //www.google.com')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 3: Testing whether submitted file is visible on the graph:'''&lt;br /&gt;
In this particular test case a file as submission for an assignment was uploaded. After this. it is checked whether this file is present in the graph.&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted file along with timestamp' do&lt;br /&gt;
   #submit a generic file for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   file_path = Rails.root + &amp;quot;spec/features/timestamp_students_submissions_spec.rb&amp;quot;&lt;br /&gt;
   attach_file('uploaded_file', file_path)&lt;br /&gt;
   click_on 'Upload file'&lt;br /&gt;
   #expect the same file to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('timestamp_students_submissions_spec.rb')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes topics in assignment are not named(eg program 2 - car rental app). In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [topic name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114499</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114499"/>
		<updated>2017-12-06T10:30:05Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currently there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img1.png]]&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about 1 year in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='  ')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file was created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
We have written tests for 3 scenarios&lt;br /&gt;
* '''Scenario 1: Testing whether deadlines are visible on the graph:'''&lt;br /&gt;
We created a dummy assignment with associated deadline in “before” statement. The code for that is:&lt;br /&gt;
&lt;br /&gt;
 before(:each) do&lt;br /&gt;
    create(:assignment, name: &amp;quot;E1797-Test&amp;quot;, directory_path: 'test_assignment')&lt;br /&gt;
    create_list(:participant, 3)&lt;br /&gt;
    create(:assignment_node)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: '2200-12-23 03:33:23')&lt;br /&gt;
    login_as(&amp;quot;student2065&amp;quot;)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Then, in the test case we tested whether the deadline is present on the graph.&lt;br /&gt;
The RSpec Feature testing code is :&lt;br /&gt;
  &lt;br /&gt;
 it 'displays review due dates along with its timestamps' do&lt;br /&gt;
   #checks whether the UI has above given deadline&lt;br /&gt;
   page.html.should include('2200-12-23 03:33:23')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 2: Testing whether submitted linked is visible on the graph:'''&lt;br /&gt;
Since we already created a assignment in the “before” statement In this particular test case, we submitted the work for an assignment in “Your Work” tab and checked whether this link is present in the graph. The RSpec code is as follows:&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted hyperlink along with timestamp' do&lt;br /&gt;
   #submit a generic link for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   fill_in &amp;quot;submission&amp;quot;, with: &amp;quot;http: //www.google.com&amp;quot;&lt;br /&gt;
   click_button &amp;quot;Upload link&amp;quot;&lt;br /&gt;
   #expect the same link to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('https: //www.google.com')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 3: Testing whether submitted file is visible on the graph:'''&lt;br /&gt;
In this particular test case a file as submission for an assignment was uploaded. After this. it is checked whether this file is present in the graph.&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted file along with timestamp' do&lt;br /&gt;
   #submit a generic file for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   file_path = Rails.root + &amp;quot;spec/features/timestamp_students_submissions_spec.rb&amp;quot;&lt;br /&gt;
   attach_file('uploaded_file', file_path)&lt;br /&gt;
   click_on 'Upload file'&lt;br /&gt;
   #expect the same file to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('timestamp_students_submissions_spec.rb')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114498</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114498"/>
		<updated>2017-12-06T10:29:45Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currently there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img1.png]]&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about 1 year in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='  ')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file was created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
We have written tests for 3 scenarios&lt;br /&gt;
* '''Scenario 1: Testing whether deadlines are visible on the graph:'''&lt;br /&gt;
We created a dummy assignment with associated deadline in “before” statement. The code for that is:&lt;br /&gt;
&lt;br /&gt;
 before(:each) do&lt;br /&gt;
    create(:assignment, name: &amp;quot;E1797-Test&amp;quot;, directory_path: 'test_assignment')&lt;br /&gt;
    create_list(:participant, 3)&lt;br /&gt;
    create(:assignment_node)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: '2200-12-23 03:33:23')&lt;br /&gt;
    login_as(&amp;quot;student2065&amp;quot;)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Then, in the test case we tested whether the deadline is present on the graph.&lt;br /&gt;
The RSpec Feature testing code is :&lt;br /&gt;
  &lt;br /&gt;
 it 'displays review due dates along with its timestamps' do&lt;br /&gt;
   #checks whether the UI has above given deadline&lt;br /&gt;
   page.html.should include('2200-12-23 03:33:23')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 2:Testing whether submitted linked is visible on the graph:'''&lt;br /&gt;
Since we already created a assignment in the “before” statement In this particular test case, we submitted the work for an assignment in “Your Work” tab and checked whether this link is present in the graph. The RSpec code is as follows:&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted hyperlink along with timestamp' do&lt;br /&gt;
   #submit a generic link for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   fill_in &amp;quot;submission&amp;quot;, with: &amp;quot;http: //www.google.com&amp;quot;&lt;br /&gt;
   click_button &amp;quot;Upload link&amp;quot;&lt;br /&gt;
   #expect the same link to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('https: //www.google.com')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Scenario 3:Testing whether submitted file is visible on the graph:'''&lt;br /&gt;
In this particular test case a file as submission for an assignment was uploaded. After this. it is checked whether this file is present in the graph.&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted file along with timestamp' do&lt;br /&gt;
   #submit a generic file for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   file_path = Rails.root + &amp;quot;spec/features/timestamp_students_submissions_spec.rb&amp;quot;&lt;br /&gt;
   attach_file('uploaded_file', file_path)&lt;br /&gt;
   click_on 'Upload file'&lt;br /&gt;
   #expect the same file to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('timestamp_students_submissions_spec.rb')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114497</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114497"/>
		<updated>2017-12-06T10:18:45Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currently there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img1.png]]&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Img2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about 1 year in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='  ')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file was created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
We have written tests for 3 scenarios&lt;br /&gt;
* '''Testing whether deadlines are visible on the graph:'''&lt;br /&gt;
We created a dummy assignment with associated deadline in “before” statement. The code for that is:&lt;br /&gt;
&lt;br /&gt;
 before(:each) do&lt;br /&gt;
    create(:assignment, name: &amp;quot;E1797-Test&amp;quot;, directory_path: 'test_assignment')&lt;br /&gt;
    create_list(:participant, 3)&lt;br /&gt;
    create(:assignment_node)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;submission&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;review&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;metareview&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;drop_topic&amp;quot;)&lt;br /&gt;
    create(:deadline_type, name: &amp;quot;team_formation&amp;quot;)&lt;br /&gt;
    create(:deadline_right)&lt;br /&gt;
    create(:deadline_right, name: 'Late')&lt;br /&gt;
    create(:deadline_right, name: 'OK')&lt;br /&gt;
    create(:assignment_due_date, deadline_type: DeadlineType.where(name: 'review').first, due_at: '2200-12-23 03:33:23')&lt;br /&gt;
    login_as(&amp;quot;student2065&amp;quot;)&lt;br /&gt;
    visit '/student_task/list'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
Then, in the test case we tested whether the deadline is present on the graph.&lt;br /&gt;
The RSpec Feature testing code is :&lt;br /&gt;
  &lt;br /&gt;
 it 'displays review due dates along with its timestamps' do&lt;br /&gt;
   #checks whether the UI has above given deadline&lt;br /&gt;
   page.html.should include('2200-12-23 03:33:23')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Testing whether submitted linked is visible on the graph:'''&lt;br /&gt;
Since we already created a assignment in the “before” statement In this particular test case, we submitted the work for an assignment in “Your Work” tab and checked whether this link is present in the graph. The RSpec code is as follows:&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted hyperlink along with timestamp' do&lt;br /&gt;
   #submit a generic link for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   fill_in &amp;quot;submission&amp;quot;, with: &amp;quot;http: //www.google.com&amp;quot;&lt;br /&gt;
   click_button &amp;quot;Upload link&amp;quot;&lt;br /&gt;
   #expect the same link to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('https: //www.google.com')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
* '''Testing whether submitted file is visible on the graph:'''&lt;br /&gt;
In this particular test case a file as submission for an assignment was uploaded. After this. it is checked whether this file is present in the graph.&lt;br /&gt;
&lt;br /&gt;
 it 'displays submitted file along with timestamp' do&lt;br /&gt;
   #submit a generic file for this assignment&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   click_link &amp;quot;Your work&amp;quot;&lt;br /&gt;
   file_path = Rails.root + &amp;quot;spec/features/timestamp_students_submissions_spec.rb&amp;quot;&lt;br /&gt;
   attach_file('uploaded_file', file_path)&lt;br /&gt;
   click_on 'Upload file'&lt;br /&gt;
   #expect the same file to be present in our graph&lt;br /&gt;
   page.all('a', :text =&amp;gt; 'Assignments')[1].click&lt;br /&gt;
   click_link &amp;quot;E1797-Test&amp;quot;&lt;br /&gt;
   page.html.should include('timestamp_students_submissions_spec.rb')&lt;br /&gt;
 end&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=114239</id>
		<title>File:S1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=114239"/>
		<updated>2017-12-02T08:27:31Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: uploaded a new version of &amp;amp;quot;File:S1.png&amp;amp;quot;: Reverted to version as of 04:09, 2 December 2017&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;s1&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=114238</id>
		<title>File:S1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=114238"/>
		<updated>2017-12-02T08:24:41Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: uploaded a new version of &amp;amp;quot;File:S1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;s1&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=114237</id>
		<title>File:S1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:S1.png&amp;diff=114237"/>
		<updated>2017-12-02T08:23:45Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: uploaded a new version of &amp;amp;quot;File:S1.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;s1&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114231</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114231"/>
		<updated>2017-12-02T08:10:29Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;); #empty hyperlink as we do not provide hyperlinks for submissions/reviews&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         #only file name instead of entire relative path need to be displayed on timeline. Hence we push the same in content, appending created time to it &lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114223</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114223"/>
		<updated>2017-12-02T08:00:55Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project, we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment. We provided dynamic functions such as zoom in/zoom out to move left/right and recenter to provide smooth user experience.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114220</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114220"/>
		<updated>2017-12-02T07:55:47Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. Through this project we aim to provide an interactive and refreshing visual timeline for all the student submissions for each assignment.&lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114219</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114219"/>
		<updated>2017-12-02T07:53:46Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface.&lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates.&lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can test for the Edge cases mentioned above too.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=114218</id>
		<title>CSC/ECE 517 Fall 2016/E1675. Timestamp for student file &amp; hyperlink submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=114218"/>
		<updated>2017-12-02T07:51:27Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1675.Timestamp for student file &amp;amp; hyperlink submissions ==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is a software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In Expertiza we accept hyperlinks as well as files submitted by students, which makes it harder to track the updates for student's submission. In this project we were required to keep track of timestamp records for student's submissions and updates of artifacts (submitted files or hyperlinks). Authors can delete or re-submit files and hyperlinks, those activities were also recorded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task Goals ===&lt;br /&gt;
What needs to be done: &lt;br /&gt;
&lt;br /&gt;
* Record the timestamps for file/hyperlink submissions.&lt;br /&gt;
* Add code to keep all those time stamps tracked and updated.&lt;br /&gt;
* Change the view of 0.0.0.0:3000/assignments/list_submissions view (by clicking the “View submissions icon”) to display the submition histories of each team.&lt;br /&gt;
* Make the available submissions clickable (some submitted items maight be deleted, so they are displayed but not clickable).&lt;br /&gt;
* After this project, the ResubmissionTime model (and related code) will not be used anymore. Please remove related code and db table.&lt;br /&gt;
* Create tests to make sure the test coverage increase.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Program Design ===&lt;br /&gt;
&lt;br /&gt;
We created a set of new controller, model and views to implement the functionality of timestamps.&lt;br /&gt;
We added a model named SubmissionRecord that contains the following attributes.&lt;br /&gt;
&lt;br /&gt;
* Hyperlink - hyperlink that could be uploaded - String.&lt;br /&gt;
* Upload File - file that could be uploaded - File.&lt;br /&gt;
* Team id - id that links the model to the team that created it. - Integer.&lt;br /&gt;
* Created at - timestamp for time of creation.&lt;br /&gt;
* Operation - Description of operation performed. - create, update and delete.&lt;br /&gt;
* User - User who change the status of current table Get this from current user id.&lt;br /&gt;
* Content - String, the file name or the hyperlink.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Action_allowed=====&lt;br /&gt;
* In present code, the application has the control to decide which kind of user could have access to the specific page. In order to let the instructor see the submission_record, we need to add action_allowed method in submission_record_controller. Below is reference code :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?&lt;br /&gt;
    if params[:action] == 'edit' || params[:action] == 'update'&lt;br /&gt;
      assignment = Assignment.find(params[:id])&lt;br /&gt;
      return true if ['Super-Administrator', 'Administrator'].include? current_role_name&lt;br /&gt;
      return true if assignment.instructor_id == current_user.id&lt;br /&gt;
      return true if TaMapping.exists?(ta_id: current_user.id, course_id: assignment.course_id) &amp;amp;&amp;amp;&lt;br /&gt;
      (TaMapping.where(course_id: assignment.course_id).include?TaMapping.where(ta_id: current_user.id, course_id: assignment.course_id).first)&lt;br /&gt;
      return true if assignment.course_id &amp;amp;&amp;amp; Course.find(assignment.course_id).instructor_id == current_user.id&lt;br /&gt;
      return false&lt;br /&gt;
    else&lt;br /&gt;
      ['Super-Administrator',&lt;br /&gt;
       'Administrator',&lt;br /&gt;
       'Instructor',&lt;br /&gt;
       'Teaching Assistant'].include? current_role_name&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Submit Hyperlink &amp;amp; File =====&lt;br /&gt;
* After we created the table, there isn't a specific page for us to fill in the submission_record database table. So we implemented this feature using the previous functionality already existent in the submitted_content controller/model. This page had information about the hyperlinks and files which were previously submitted by the student. We add functionality to fill in submission_record table once a hyperlink or file is submitted. Below is a code snippet for reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def submit_hyperlink&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    return unless current_user_id?(@participant.user_id)&lt;br /&gt;
&lt;br /&gt;
    team = @participant.team&lt;br /&gt;
    team_hyperlinks = team.hyperlinks&lt;br /&gt;
    if team_hyperlinks.include?(params['submission'])&lt;br /&gt;
      flash[:error] = &amp;quot;You or your teammate(s) have already submitted the same hyperlink.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      begin&lt;br /&gt;
        team.submit_hyperlink(params['submission'])&lt;br /&gt;
        @participant.update_resubmit_times&lt;br /&gt;
&lt;br /&gt;
        #create a submission record&lt;br /&gt;
        @submission_record = SubmissionRecord.new(team_id: team, user: @participant.name, assignment_id: params[:id], operation: &amp;quot;Submit Hyperlink&amp;quot;)&lt;br /&gt;
        @submission_record.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = &amp;quot;The URL or URI is not valid. Reason: #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      undo_link(&amp;quot;The link has been successfully submitted.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'edit', id: @participant.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#create a submission record&lt;br /&gt;
    assignment = Assignment.find(participant.parent_id)&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user: participant.name , assignment_id: assignment.id, operation: &amp;quot;Submit File&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Remove Hyperlink or File=====&lt;br /&gt;
* When students want to delete their hyperlinks or files which they had submitted before, the data in submission_record table should not disappear. We wanted to save all the operations made by the team. As a result, we added specific functionality in the existing delete function to reserve the data in submission_record table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#create a submission record&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user:@participant.name , assignment_id: assignment.id, operation: &amp;quot;Remove Hyperlink&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def delete_selected_files&lt;br /&gt;
    #create a submission record&lt;br /&gt;
    assignment = Assignment.find(participant.parent_id)&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user: participant.name , assignment_id: assignment.id, operation: &amp;quot;Remove File&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
    filename = params[:directories][params[:chk_files]] + &amp;quot;/&amp;quot; + params[:filenames][params[:chk_files]]&lt;br /&gt;
    FileUtils.rm_r(filename)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====View Submission Record =====&lt;br /&gt;
* In order to make the student submitted hyperlinks clickable, we check if the operation performed is 'Submit Hyperlink' in database.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if record.operation == &amp;quot;Submit Hyperlink&amp;quot; %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;a href=&amp;quot;&amp;lt;%= record.content %&amp;gt;&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&amp;lt;%= record.content %&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;%= record.content %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%= record.created_at %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Parameter Passing====&lt;br /&gt;
We utilize the params hash from the previous view called List_submissions. We then use a WHERE SQL query that matches the team_id from the submissions record table.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%= link_to &amp;quot;Show Submission Records&amp;quot;, submission_records_path(team_id: team.id) %&amp;gt;(View:list_submission)&lt;br /&gt;
     @submission_records = SubmissionRecord.where(team_id: params[:team_id])(submission_record_controller)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The testing for this project has been done using several advanced ruby features. Below are a few of the features which were used :&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl FFaker ruby gem]&lt;br /&gt;
&lt;br /&gt;
Using these techniques, the project was thoroughly tested. &lt;br /&gt;
&lt;br /&gt;
Models were tested for their validation. We had to verify each of the parameters which we received in our model. This was done by developing a Ruby Factory which had sample data. This sample data was fed into the models. Using RSpec, we then checked for validity for each of the parameters received in the models. This validity check is important since this information is prerequisite for having a perfectly working controller and view.&lt;br /&gt;
&lt;br /&gt;
Below is a code snippet which describes the testing methodology. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe SubmissionRecord do&lt;br /&gt;
  it 'is invalid without a team id' do&lt;br /&gt;
    expect(build(:submission_record, team_id: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an operation' do&lt;br /&gt;
    expect(build(:submission_record, operation: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without a user' do&lt;br /&gt;
    expect(build(:submission_record, user: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an assignment id' do&lt;br /&gt;
    expect(build(:submission_record, assignment_id: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an operation' do&lt;br /&gt;
    expect(build(:submission_record, operation: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers were tested to make sure the rendering, redirection and views are proper.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Steps for testing the project using the User Interface. &lt;br /&gt;
*As an instructor, go to manage assignments.&lt;br /&gt;
*Click on submissions view of an assignment.&lt;br /&gt;
*You will see all the items submissions.&lt;br /&gt;
*Click on &amp;quot;Show Submission Records&amp;quot;.&lt;br /&gt;
*You will see a history of the submission along with the timestamps for each submission.&lt;br /&gt;
*You can also see when the submission was added, updated and removed.&lt;br /&gt;
*Visit below video link to see an interactive demo.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Demo link]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/rsndates/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A Handbook of Agile Software Craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=114217</id>
		<title>CSC/ECE 517 Fall 2016/E1675. Timestamp for student file &amp; hyperlink submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=114217"/>
		<updated>2017-12-02T07:46:30Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: Undo revision 104194 by Agoel4 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1675.Timestamp for student file &amp;amp; hyperlink submissions ==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is a software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In Expertiza we accept hyperlinks as well as files submitted by students, which makes it harder to track the updates for student's submission. In this project we were required to keep track of timestamp records for student's submissions and updates of artifacts (submitted files or hyperlinks). Authors can delete or re-submit files and hyperlinks, those activities were also recorded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task Goals ===&lt;br /&gt;
What needs to be done: &lt;br /&gt;
&lt;br /&gt;
* Record the timestamps for file/hyperlink submissions.&lt;br /&gt;
* Add code to keep all those time stamps tracked and updated.&lt;br /&gt;
* Change the view of 0.0.0.0:3000/assignments/list_submissions view (by clicking the “View submissions icon”) to display the submition histories of each team.&lt;br /&gt;
* Make the available submissions clickable (some submitted items maight be deleted, so they are displayed but not clickable).&lt;br /&gt;
* After this project, the ResubmissionTime model (and related code) will not be used anymore. Please remove related code and db table.&lt;br /&gt;
* Create tests to make sure the test coverage increase.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Program Design ===&lt;br /&gt;
&lt;br /&gt;
We created a set of new controller, model and views to implement the functionality of timestamps.&lt;br /&gt;
We added a model named SubmissionRecord that contains the following attributes.&lt;br /&gt;
&lt;br /&gt;
* Hyperlink - hyperlink that could be uploaded - String.&lt;br /&gt;
* Upload File - file that could be uploaded - File.&lt;br /&gt;
* Team id - id that links the model to the team that created it. - Integer.&lt;br /&gt;
* Created at - timestamp for time of creation.&lt;br /&gt;
* Operation - Description of operation performed. - create, update and delete.&lt;br /&gt;
* User - User who change the status of current table Get this from current user id.&lt;br /&gt;
* Content - String, the file name or the hyperlink.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Action_allowed=====&lt;br /&gt;
* In present code, the application has the control to decide which kind of user could have access to the specific page. In order to let the instructor see the submission_record, we need to add action_allowed method in submission_record_controller. Below is reference code :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?&lt;br /&gt;
    if params[:action] == 'edit' || params[:action] == 'update'&lt;br /&gt;
      assignment = Assignment.find(params[:id])&lt;br /&gt;
      return true if ['Super-Administrator', 'Administrator'].include? current_role_name&lt;br /&gt;
      return true if assignment.instructor_id == current_user.id&lt;br /&gt;
      return true if TaMapping.exists?(ta_id: current_user.id, course_id: assignment.course_id) &amp;amp;&amp;amp;&lt;br /&gt;
      (TaMapping.where(course_id: assignment.course_id).include?TaMapping.where(ta_id: current_user.id, course_id: assignment.course_id).first)&lt;br /&gt;
      return true if assignment.course_id &amp;amp;&amp;amp; Course.find(assignment.course_id).instructor_id == current_user.id&lt;br /&gt;
      return false&lt;br /&gt;
    else&lt;br /&gt;
      ['Super-Administrator',&lt;br /&gt;
       'Administrator',&lt;br /&gt;
       'Instructor',&lt;br /&gt;
       'Teaching Assistant'].include? current_role_name&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Submit Hyperlink &amp;amp; File =====&lt;br /&gt;
* After we created the table, there isn't a specific page for us to fill in the submission_record database table. So we implemented this feature using the previous functionality already existent in the submitted_content controller/model. This page had information about the hyperlinks and files which were previously submitted by the student. We add functionality to fill in submission_record table once a hyperlink or file is submitted. Below is a code snippet for reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def submit_hyperlink&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    return unless current_user_id?(@participant.user_id)&lt;br /&gt;
&lt;br /&gt;
    team = @participant.team&lt;br /&gt;
    team_hyperlinks = team.hyperlinks&lt;br /&gt;
    if team_hyperlinks.include?(params['submission'])&lt;br /&gt;
      flash[:error] = &amp;quot;You or your teammate(s) have already submitted the same hyperlink.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      begin&lt;br /&gt;
        team.submit_hyperlink(params['submission'])&lt;br /&gt;
        @participant.update_resubmit_times&lt;br /&gt;
&lt;br /&gt;
        #create a submission record&lt;br /&gt;
        @submission_record = SubmissionRecord.new(team_id: team, user: @participant.name, assignment_id: params[:id], operation: &amp;quot;Submit Hyperlink&amp;quot;)&lt;br /&gt;
        @submission_record.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = &amp;quot;The URL or URI is not valid. Reason: #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      undo_link(&amp;quot;The link has been successfully submitted.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'edit', id: @participant.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#create a submission record&lt;br /&gt;
    assignment = Assignment.find(participant.parent_id)&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user: participant.name , assignment_id: assignment.id, operation: &amp;quot;Submit File&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Remove Hyperlink or File=====&lt;br /&gt;
* When students want to delete their hyperlinks or files which they had submitted before, the data in submission_record table should not disappear. We wanted to save all the operations made by the team. As a result, we added specific functionality in the existing delete function to reserve the data in submission_record table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#create a submission record&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user:@participant.name , assignment_id: assignment.id, operation: &amp;quot;Remove Hyperlink&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def delete_selected_files&lt;br /&gt;
    #create a submission record&lt;br /&gt;
    assignment = Assignment.find(participant.parent_id)&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user: participant.name , assignment_id: assignment.id, operation: &amp;quot;Remove File&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
    filename = params[:directories][params[:chk_files]] + &amp;quot;/&amp;quot; + params[:filenames][params[:chk_files]]&lt;br /&gt;
    FileUtils.rm_r(filename)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====View Submission Record =====&lt;br /&gt;
* In order to make the student submitted hyperlinks clickable, we check if the operation performed is 'Submit Hyperlink' in database.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if record.operation == &amp;quot;Submit Hyperlink&amp;quot; %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;a href=&amp;quot;&amp;lt;%= record.content %&amp;gt;&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&amp;lt;%= record.content %&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;%= record.content %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%= record.created_at %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Parameter Passing====&lt;br /&gt;
We utilize the params hash from the previous view called List_submissions. We then use a WHERE SQL query that matches the team_id from the submissions record table.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%= link_to &amp;quot;Show Submission Records&amp;quot;, submission_records_path(team_id: team.id) %&amp;gt;(View:list_submission)&lt;br /&gt;
     @submission_records = SubmissionRecord.where(team_id: params[:team_id])(submission_record_controller)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The testing for this project has been done using several advanced ruby features. Below are a few of the features which were used :&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl FFaker ruby gem]&lt;br /&gt;
&lt;br /&gt;
Using these techniques, the project was thoroughly tested. &lt;br /&gt;
&lt;br /&gt;
Models were tested for their validation. We had to verify each of the parameters which we received in our model. This was done by developing a Ruby Factory which had sample data. This sample data was fed into the models. Using RSpec, we then checked for validity for each of the parameters received in the models. This validity check is important since this information is prerequisite for having a perfectly working controller and view.&lt;br /&gt;
&lt;br /&gt;
Below is a code snippet which describes the testing methodology. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe SubmissionRecord do&lt;br /&gt;
  it 'is invalid without a team id' do&lt;br /&gt;
    expect(build(:submission_record, team_id: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an operation' do&lt;br /&gt;
    expect(build(:submission_record, operation: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without a user' do&lt;br /&gt;
    expect(build(:submission_record, user: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an assignment id' do&lt;br /&gt;
    expect(build(:submission_record, assignment_id: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an operation' do&lt;br /&gt;
    expect(build(:submission_record, operation: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers were tested to make sure the rendering, redirection and views are proper.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface. &lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates. &lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can '''test''' for the '''Edge cases''' mentioned above too.&lt;br /&gt;
*Video link for an interactive demo.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/rsndates/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A Handbook of Agile Software Craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114212</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114212"/>
		<updated>2017-12-02T07:40:18Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Steps for testing the project using the User Interface. &lt;br /&gt;
*As an instructor, go to manage assignments.&lt;br /&gt;
*Click on submissions view of an assignment.&lt;br /&gt;
*You will see all the items submissions.&lt;br /&gt;
*Click on &amp;quot;Show Submission Records&amp;quot;.&lt;br /&gt;
*You will see a history of the submission along with the timestamps for each submission.&lt;br /&gt;
*You can also see when the submission was added, updated and removed.&lt;br /&gt;
&lt;br /&gt;
*[ Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114211</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114211"/>
		<updated>2017-12-02T07:40:01Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Steps for testing the project using the User Interface. &lt;br /&gt;
*As an instructor, go to manage assignments.&lt;br /&gt;
*Click on submissions view of an assignment.&lt;br /&gt;
*You will see all the items submissions.&lt;br /&gt;
*Click on &amp;quot;Show Submission Records&amp;quot;.&lt;br /&gt;
*You will see a history of the submission along with the timestamps for each submission.&lt;br /&gt;
*You can also see when the submission was added, updated and removed.&lt;br /&gt;
*Visit below video link to see an interactive demo.&lt;br /&gt;
&lt;br /&gt;
*[ Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114210</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114210"/>
		<updated>2017-12-02T07:39:36Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Test Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
===Automated test using RSpec===&lt;br /&gt;
&lt;br /&gt;
Resources -&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
&lt;br /&gt;
A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Steps for testing the project using the User Interface. &lt;br /&gt;
*As an instructor, go to manage assignments.&lt;br /&gt;
*Click on submissions view of an assignment.&lt;br /&gt;
*You will see all the items submissions.&lt;br /&gt;
*Click on &amp;quot;Show Submission Records&amp;quot;.&lt;br /&gt;
*You will see a history of the submission along with the timestamps for each submission.&lt;br /&gt;
*You can also see when the submission was added, updated and removed.&lt;br /&gt;
*Visit below video link to see an interactive demo.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo link]&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=114206</id>
		<title>CSC/ECE 517 Fall 2016/E1675. Timestamp for student file &amp; hyperlink submissions</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=114206"/>
		<updated>2017-12-02T07:36:11Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Testing from UI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==E1675.Timestamp for student file &amp;amp; hyperlink submissions ==&lt;br /&gt;
&lt;br /&gt;
This page provides a description of the Expertiza based OSS project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===About Expertiza===&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is an open source project based on [http://rubyonrails.org/ Ruby on Rails] framework. Expertiza is a software to create reusable learning objects through peer review. It also supports team projects, and the submission of almost any document type, including URLs and wiki pages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Statement===&lt;br /&gt;
In Expertiza we accept hyperlinks as well as files submitted by students, which makes it harder to track the updates for student's submission. In this project we were required to keep track of timestamp records for student's submissions and updates of artifacts (submitted files or hyperlinks). Authors can delete or re-submit files and hyperlinks, those activities were also recorded.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Task Goals ===&lt;br /&gt;
What needs to be done: &lt;br /&gt;
&lt;br /&gt;
* Record the timestamps for file/hyperlink submissions.&lt;br /&gt;
* Add code to keep all those time stamps tracked and updated.&lt;br /&gt;
* Change the view of 0.0.0.0:3000/assignments/list_submissions view (by clicking the “View submissions icon”) to display the submission histories of each team.&lt;br /&gt;
* Make the available submissions clickable (some submitted items might be deleted, so they are displayed but not clickable).&lt;br /&gt;
* After this project, the ResubmissionTime model (and related code) will not be used anymore. Please remove related code and db table.&lt;br /&gt;
* Create tests to make sure the test coverage increase.&lt;br /&gt;
&lt;br /&gt;
===Program Design ===&lt;br /&gt;
&lt;br /&gt;
We created a set of new controller, model and views to implement the functionality of timestamps.&lt;br /&gt;
We added a model named SubmissionRecord that contains the following attributes.&lt;br /&gt;
&lt;br /&gt;
* Hyperlink - hyperlink that could be uploaded - String.&lt;br /&gt;
* Upload File - file that could be uploaded - File.&lt;br /&gt;
* Team id - id that links the model to the team that created it. - Integer.&lt;br /&gt;
* Created at - timestamp for time of creation.&lt;br /&gt;
* Operation - Description of operation performed. - create, update and delete.&lt;br /&gt;
* User - User who change the status of current table Get this from current user id.&lt;br /&gt;
* Content - String, the file name or the hyperlink.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Action_allowed=====&lt;br /&gt;
* In present code, the application has the control to decide which kind of user could have access to the specific page. In order to let the instructor see the submission_record, we need to add action_allowed method in submission_record_controller. Below is reference code :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def action_allowed?&lt;br /&gt;
    if params[:action] == 'edit' || params[:action] == 'update'&lt;br /&gt;
      assignment = Assignment.find(params[:id])&lt;br /&gt;
      return true if ['Super-Administrator', 'Administrator'].include? current_role_name&lt;br /&gt;
      return true if assignment.instructor_id == current_user.id&lt;br /&gt;
      return true if TaMapping.exists?(ta_id: current_user.id, course_id: assignment.course_id) &amp;amp;&amp;amp;&lt;br /&gt;
      (TaMapping.where(course_id: assignment.course_id).include?TaMapping.where(ta_id: current_user.id, course_id: assignment.course_id).first)&lt;br /&gt;
      return true if assignment.course_id &amp;amp;&amp;amp; Course.find(assignment.course_id).instructor_id == current_user.id&lt;br /&gt;
      return false&lt;br /&gt;
    else&lt;br /&gt;
      ['Super-Administrator',&lt;br /&gt;
       'Administrator',&lt;br /&gt;
       'Instructor',&lt;br /&gt;
       'Teaching Assistant'].include? current_role_name&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Submit Hyperlink &amp;amp; File =====&lt;br /&gt;
* After we created the table, there isn't a specific page for us to fill in the submission_record database table. So we implemented this feature using the previous functionality already existent in the submitted_content controller/model. This page had information about the hyperlinks and files which were previously submitted by the student. We add functionality to fill in submission_record table once a hyperlink or file is submitted. Below is a code snippet for reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 def submit_hyperlink&lt;br /&gt;
&lt;br /&gt;
    @participant = AssignmentParticipant.find(params[:id])&lt;br /&gt;
    return unless current_user_id?(@participant.user_id)&lt;br /&gt;
&lt;br /&gt;
    team = @participant.team&lt;br /&gt;
    team_hyperlinks = team.hyperlinks&lt;br /&gt;
    if team_hyperlinks.include?(params['submission'])&lt;br /&gt;
      flash[:error] = &amp;quot;You or your teammate(s) have already submitted the same hyperlink.&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      begin&lt;br /&gt;
        team.submit_hyperlink(params['submission'])&lt;br /&gt;
        @participant.update_resubmit_times&lt;br /&gt;
&lt;br /&gt;
        #create a submission record&lt;br /&gt;
        @submission_record = SubmissionRecord.new(team_id: team, user: @participant.name, assignment_id: params[:id], operation: &amp;quot;Submit Hyperlink&amp;quot;)&lt;br /&gt;
        @submission_record.save&lt;br /&gt;
      rescue&lt;br /&gt;
        flash[:error] = &amp;quot;The URL or URI is not valid. Reason: #{$ERROR_INFO}&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      undo_link(&amp;quot;The link has been successfully submitted.&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
    redirect_to action: 'edit', id: @participant.id&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#create a submission record&lt;br /&gt;
    assignment = Assignment.find(participant.parent_id)&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user: participant.name , assignment_id: assignment.id, operation: &amp;quot;Submit File&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Remove Hyperlink or File=====&lt;br /&gt;
* When students want to delete their hyperlinks or files which they had submitted before, the data in submission_record table should not disappear. We wanted to save all the operations made by the team. As a result, we added specific functionality in the existing delete function to reserve the data in submission_record table.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#create a submission record&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user:@participant.name , assignment_id: assignment.id, operation: &amp;quot;Remove Hyperlink&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
def delete_selected_files&lt;br /&gt;
    #create a submission record&lt;br /&gt;
    assignment = Assignment.find(participant.parent_id)&lt;br /&gt;
    team = participant.team&lt;br /&gt;
    @submission_record = SubmissionRecord.new(team_id: team.id, user: participant.name , assignment_id: assignment.id, operation: &amp;quot;Remove File&amp;quot;)&lt;br /&gt;
    @submission_record.save&lt;br /&gt;
    filename = params[:directories][params[:chk_files]] + &amp;quot;/&amp;quot; + params[:filenames][params[:chk_files]]&lt;br /&gt;
    FileUtils.rm_r(filename)&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====View Submission Record =====&lt;br /&gt;
* In order to make the student submitted hyperlinks clickable, we check if the operation performed is 'Submit Hyperlink' in database.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;% if record.operation == &amp;quot;Submit Hyperlink&amp;quot; %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;a href=&amp;quot;&amp;lt;%= record.content %&amp;gt;&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;&amp;lt;%= record.content %&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;% else %&amp;gt;&lt;br /&gt;
            &amp;lt;td&amp;gt;&amp;lt;%= record.content %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
         &amp;lt;% end %&amp;gt;&lt;br /&gt;
        &amp;lt;td&amp;gt;&amp;lt;%= record.created_at %&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Parameter Passing====&lt;br /&gt;
We utilize the params hash from the previous view called List_submissions. We then use a WHERE SQL query that matches the team_id from the submissions record table.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;%= link_to &amp;quot;Show Submission Records&amp;quot;, submission_records_path(team_id: team.id) %&amp;gt;(View:list_submission)&lt;br /&gt;
     @submission_records = SubmissionRecord.where(team_id: params[:team_id])(submission_record_controller)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Automated Testing using RSPEC===&lt;br /&gt;
The testing for this project has been done using several advanced ruby features. Below are a few of the features which were used :&lt;br /&gt;
* [http://rspec.info/ RSpec]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl Factory Girl ruby gem]&lt;br /&gt;
* [https://github.com/thoughtbot/factory_girl FFaker ruby gem]&lt;br /&gt;
&lt;br /&gt;
Using these techniques, the project was thoroughly tested. &lt;br /&gt;
&lt;br /&gt;
Models were tested for their validation. We had to verify each of the parameters which we received in our model. This was done by developing a Ruby Factory which had sample data. This sample data was fed into the models. Using RSpec, we then checked for validity for each of the parameters received in the models. This validity check is important since this information is prerequisite for having a perfectly working controller and view.&lt;br /&gt;
&lt;br /&gt;
Below is a code snippet which describes the testing methodology. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require 'rails_helper'&lt;br /&gt;
describe SubmissionRecord do&lt;br /&gt;
  it 'is invalid without a team id' do&lt;br /&gt;
    expect(build(:submission_record, team_id: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an operation' do&lt;br /&gt;
    expect(build(:submission_record, operation: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without a user' do&lt;br /&gt;
    expect(build(:submission_record, user: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an assignment id' do&lt;br /&gt;
    expect(build(:submission_record, assignment_id: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
  it 'is invalid without an operation' do&lt;br /&gt;
    expect(build(:submission_record, operation: nil)).to_not be_valid&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Controllers were tested to make sure the rendering, redirection and views are proper.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing from UI===&lt;br /&gt;
Testing the project using the User Interface. &lt;br /&gt;
*Login as an instructor, go to manage assignments-&amp;gt; select an assignment-&amp;gt; add students to assignment-&amp;gt;update duedates. &lt;br /&gt;
*Impersonate as one of student -&amp;gt; navigate to the particular assignment edited in above step.&lt;br /&gt;
*You shall see a timeline with duedates&lt;br /&gt;
*Click on your work, submit hyperlink/files, same will be displayed in that particular assignment home page(navigate to previous page)&lt;br /&gt;
*Review teammates work/ give a peer review/ submit a self review/ submit feedback to review received, same will be reflected in respective assignment home page along with a hyperlink to the particular review given.&lt;br /&gt;
*The submission along with the timestamps for each submission along with hyperlinks to each of student's work is displayed in timeline.&lt;br /&gt;
*One can '''test''' for the '''Edge cases''' mentioned above too.&lt;br /&gt;
*Video link for an interactive demo.&lt;br /&gt;
&lt;br /&gt;
*[https://youtu.be/cGXu1YPG0Ec Interactive Video Demo]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[https://github.com/rsndates/expertiza GitHub Project Repository Fork]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#Clean Code: A Handbook of Agile Software Craftsmanship. Author: Robert C Martin&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114202</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114202"/>
		<updated>2017-12-02T07:23:56Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;br /&gt;
#[https://github.com/ShyamKatta/expertiza/tree/E1797/ Github - expertiza forked repository]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114200</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114200"/>
		<updated>2017-12-02T07:16:28Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;br /&gt;
#[ Github pull request submitted]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114199</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114199"/>
		<updated>2017-12-02T07:14:20Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Program Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
&lt;br /&gt;
The '''percentage of zoom, percentage of window to move right/left''' can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons mentioned in later section of wiki.&lt;br /&gt;
&lt;br /&gt;
We have added '''hyperlinks to enable quick access to all of the student submitted content'''. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114198</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114198"/>
		<updated>2017-12-02T07:11:10Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Program Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* ''Zoom in''    -  To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* ''Zoom out''   -  To zoom out of the timeline&lt;br /&gt;
* ''Move Left''  -  To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* ''Move Right'' -  To move backward along the x-axis&lt;br /&gt;
* '''Recenter''' -  Pressing this button helps the user to '''reset the zoom scale''' and the position of the x-axis in a way that all the items appear '''sorted in a single window.'''&lt;br /&gt;
A single '''vertical red line''' set to the '''current time''' on the x-axis indicates the current time at which the timeline is being viewed.&lt;br /&gt;
The percentage of zoom, percentage of window to move right/left can be modified as per convenience as mentioned in &amp;lt;script&amp;gt; of zoom buttons &lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114196</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114196"/>
		<updated>2017-12-02T06:51:59Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Database Tables Involved */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
*participants&lt;br /&gt;
*assignments&lt;br /&gt;
*users&lt;br /&gt;
*teams&lt;br /&gt;
*teams_users&lt;br /&gt;
*signed_up_teams&lt;br /&gt;
*sign_up_topics&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114195</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114195"/>
		<updated>2017-12-02T06:47:51Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Program Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''Cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114194</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114194"/>
		<updated>2017-12-02T06:47:38Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Program Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions and '''cream''' color for feedback, peer review, team review and self review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114193</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114193"/>
		<updated>2017-12-02T06:46:14Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Understanding Problem Statement */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to provide the submitted '''hyperlink or a link''' to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph.&lt;br /&gt;
'''Note:''' this review is the peer review '''given by this particular student''' to different teams as part of the assignment, '''not the reviews the student received.'''&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114192</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114192"/>
		<updated>2017-12-02T06:35:10Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114191</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114191"/>
		<updated>2017-12-02T06:34:13Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Future modifications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/expertiza/expertiza Expertiza on GitHub]&lt;br /&gt;
#[http://expertiza.ncsu.edu/ The live Expertiza website]&lt;br /&gt;
#[http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation Expertiza project documentation wiki]&lt;br /&gt;
#[https://relishapp.com/rspec Rspec Documentation]&lt;br /&gt;
#[http://visjs.org/docs/timeline/ Vis.js Documentation for Timeline]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114190</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114190"/>
		<updated>2017-12-02T06:33:24Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Program Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https ://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114189</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114189"/>
		<updated>2017-12-02T06:29:54Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Edge Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
'''A submission must be made before a peer review can be given'''&lt;br /&gt;
&lt;br /&gt;
* This condition holds even if the deadline has already passed.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114188</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114188"/>
		<updated>2017-12-02T06:27:00Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} &lt;br /&gt;
     and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+&lt;br /&gt;
         submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114187</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114187"/>
		<updated>2017-12-02T06:25:44Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
             Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114186</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114186"/>
		<updated>2017-12-02T06:24:46Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review -&lt;br /&gt;
 Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback -&lt;br /&gt;
 Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review -&lt;br /&gt;
 Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - &lt;br /&gt;
Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114185</id>
		<title>CSC/ECE 517 Fall 2017/E1797 Timestamps for students submission</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1797_Timestamps_for_students_submission&amp;diff=114185"/>
		<updated>2017-12-02T06:23:56Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Edge Cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Expertiza is an open source project created using Ruby on Rails. Students can upload and submit their assignments and related work online for grading purposes. &lt;br /&gt;
&lt;br /&gt;
===Existing System===&lt;br /&gt;
&lt;br /&gt;
Currently, there exist various types of submissions that a student can make for an assignment for which timestamps are generated. &lt;br /&gt;
*When a student submits links or uploads files as submissions to an assignment in Expertiza, a timestamp is created for the date and time at which each of the submissions was done. &lt;br /&gt;
*The student may also be able to give reviews to other works for a particular assignment. These reviews when submitted also have an associated timestamp. &lt;br /&gt;
*There also exist timestamps for deadlines that have passed and that are upcoming for an assignment submission or a review to be done. &lt;br /&gt;
*For the reviews that a student receives for his work, the student can give feedback to each of the reviews. The submitted feedbacks also get timestamps. &lt;br /&gt;
&lt;br /&gt;
Currenty there exists no functionality to view all these submissions and their timestamps in a single, aggregated way.&lt;br /&gt;
&lt;br /&gt;
===Proposed System===&lt;br /&gt;
&lt;br /&gt;
Our project was to solve this issue by creating a Visualization that helps the student view all the timestamps for his submissions. The goal is to create a Timeline that shows all the timestamps of submitted records and links to the submitted content wherever necessary. The default state of the timeline is a point on the x-axis set to the current date and time. The timeline is interactive and allows the user to zoom in and out to change the viewing scale of the timeline. The user can also scroll in the timeline to move the timeline forward or backward from the current time. After all of this is done, the user can reset the timeline to change his view to the default state. &lt;br /&gt;
&lt;br /&gt;
With this, the student is able to view his entire submission history for an assignment in a convenient way.&lt;br /&gt;
&lt;br /&gt;
==Problem Statement==&lt;br /&gt;
&lt;br /&gt;
In Expertiza, it is possible for the instructor to view the submission records of a particular student. However, there is no way for students to check the history of their submission records. In this project, we are required to keep track of students’ activities and visualize them on their end by using a timeline chart.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;What needs to be visualized on the timeline:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Hyperlink submission record with timestamps&lt;br /&gt;
* File upload record with timestamps&lt;br /&gt;
* Due dates&lt;br /&gt;
*Visualization of Peer review of others works, which includes: &lt;br /&gt;
** A Review hyperlink that redirects to the review by clicking on it&lt;br /&gt;
** The Round number (To be displayed only if the assignment has multiple rounds)&lt;br /&gt;
** Timestamps &lt;br /&gt;
*Visualization of Author feedback on others review, which includes: &lt;br /&gt;
** A Feedback hyperlink that redirects to the feedback by clicking on it&lt;br /&gt;
** Timestamps&lt;br /&gt;
&lt;br /&gt;
===Understanding Problem Statement===&lt;br /&gt;
&lt;br /&gt;
The problem statement states the following issues that had to be resolved.&lt;br /&gt;
&lt;br /&gt;
'''Issue-1:'''&lt;br /&gt;
Submission records with timestamps:&lt;br /&gt;
&lt;br /&gt;
A student can submit their work for an assignment using &amp;quot;Your work&amp;quot; button in the respective assignment page. Students have two options to submit their work :&lt;br /&gt;
* Giving a hyperlink.&lt;br /&gt;
* Uploading a file.&lt;br /&gt;
As soon as the user submits any one of these, we needed to show hyperlink or file with the time-stamp on our visualization graph. Also, we needed to show the submitted hyperlink or a link to the file on the visualization so that it will be easy for the user to navigate from a single page.&lt;br /&gt;
&lt;br /&gt;
'''Issue-2:'''&lt;br /&gt;
Due dates:&lt;br /&gt;
&lt;br /&gt;
There are different due dates for every assignment like Round-1 submission, Round-2 submission, Round-1 review and Round-2 review Due Dates. These are different from submission time stamps because a submission's timestamp depends upon the time at which the user had submitted the work whereas a due date is the deadline date fixed by an instructor. Visualizing them by adding them into the timeline, helps the student to track all due dates in a single graph.&lt;br /&gt;
&lt;br /&gt;
'''Issue-3:'''&lt;br /&gt;
Peer Review other's work:&lt;br /&gt;
&lt;br /&gt;
A student needs to review work of different teams during the course of the assignment. As of now in order to view the review, Expertiza requires the user to go to the &amp;quot;other's work&amp;quot; page in the assignment. Instead of this, we want this data to be viewed in our visualization graph. This issue includes a timestamp, link to view review, review round number to be shown in the graph. One important point to note is that this review is the review given by this particular student to different teams as part of the assignment, not the review that the student got.&lt;br /&gt;
&lt;br /&gt;
'''Issue-4:'''&lt;br /&gt;
Author's feedback on other's Review&lt;br /&gt;
:&lt;br /&gt;
A student can give feedback for the review he/she received for a specific assignment. So this information also needs to be included in the graph. We need to show the timestamp and hyperlink to the feedback. It must be noted that the feedback here is not the feedback he got for review given by him/her but the feedback he/she gave for the reviews the had received.&lt;br /&gt;
&lt;br /&gt;
==Program Design==&lt;br /&gt;
&lt;br /&gt;
To visualize the timeline graphically we decided to use the vis.js JavaScript library. This library provides various interactive visualization charts (like graphs, networks, timelines, etc) to visualize data in real time.   We chose to work on this library because when compared to other popular visualization libraries, vis.js provides the best possible representation of a timeline, one that meets the requirements of our project. To know more about how to make a timeline using vis.js, click [http://visjs.org/docs/timeline/ here]. &lt;br /&gt;
&lt;br /&gt;
The timeline contains a single horizontal axis that is divided into time intervals equally separated from each other. &lt;br /&gt;
&lt;br /&gt;
Let us consider an example where a student makes several submissions to an assignment. The student uploads a hyperlink &amp;quot;https://www.facebook.com&amp;quot; and an HTML file as submissions. The assignment has several deadlines or due dates. There are due dates for Round 1 and Round 2 submissions for this particular assignment. There are also review deadlines for each of the rounds for the assignment. The student can give a peer review to other students' work on the assignment. The student is able to give feedback to the peer reviews that he received. We have used color coding to differentiate between different kinds of things visualized on the timeline. We have used '''Orange''' color for a round's submission and review deadline and '''Green''' color for all hyperlink submissions, file submissions, feedback and peer review submissions. &lt;br /&gt;
&lt;br /&gt;
So in summary, the following things have to be present on the timeline that are visualized as rectangular boxes on the timeline:&lt;br /&gt;
* The submission hyperlink box with the hyperlink&lt;br /&gt;
* The file upload box with a link to the uploaded file&lt;br /&gt;
* The Round 1 peer review deadline&lt;br /&gt;
* The Round 1 submission due date&lt;br /&gt;
* The Round 2 peer review deadline&lt;br /&gt;
* The Round 2 submission due date&lt;br /&gt;
* The Peer Review that the student gave to other students&lt;br /&gt;
* The feedback that the student gave to received reviews&lt;br /&gt;
* A self-feedback that the student gave to himself&lt;br /&gt;
* A team review that the student can give to his teammates&lt;br /&gt;
* Additionally, all the rectangular boxed have timestamps that display when the submission was made or the due date of that task&lt;br /&gt;
&lt;br /&gt;
Apart from this, various buttons were also added to better interact with the timeline. These include:&lt;br /&gt;
* Zoom in - To zoom in by magnifying the viewing scale of the timeline&lt;br /&gt;
* Zoom out - To zoom out of the timeline&lt;br /&gt;
* Move Left - To move along the timeline's x-axis. The user can move forward by pressing the button&lt;br /&gt;
* Move Right - To move backward along the x-axis&lt;br /&gt;
* Recenter - A single vertical red line set to the current time on the x-axis indicates the current time at which the timeline is being viewed. Pressing this button helps the user to reset the zoom scale and the position of the x-axis in a way that the red line is at the center of the timeline.&lt;br /&gt;
&lt;br /&gt;
We have added hyperlinks to enable quick access to the submitted content. For example, the rectangular box that shows the submitted file has a hyperlink that links to the contents of the file. Similarly, the reviews submitted by the student is linked by the hyperlink in the Peer review rectangular box on the timeline. &lt;br /&gt;
&lt;br /&gt;
Finally, after obtaining all the data from the database and the inclusion of all the stated information above to visualizing it in the timeline, the result would be something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When the user selects a particular rectangular box on the timeline by clicking on it, then the line that connects the box to the timeline's x-axis becomes thicker and the color of the box also changes to '''White''' to indicate to the user the current box that is selected. If the user selects the file submission rectangular box (sample.html file), then the timeline would look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S2.png]]&lt;br /&gt;
&lt;br /&gt;
==Files Involved==&lt;br /&gt;
&lt;br /&gt;
*app/controllers/submission_records_controller.rb&lt;br /&gt;
*app/models/submission_record.rb&lt;br /&gt;
*app/views/student_task/list.html.erb&lt;br /&gt;
&lt;br /&gt;
==Database Tables Involved==&lt;br /&gt;
&lt;br /&gt;
*submission_records&lt;br /&gt;
*response_map&lt;br /&gt;
*due_dates&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code to embed the timeline into the webpage is as follows &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; div id=&amp;quot;visualization&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; div class=&amp;quot;menu&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomIn&amp;quot; value=&amp;quot;Zoom in&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;zoomOut&amp;quot; value=&amp;quot;Zoom out&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveLeft&amp;quot; value=&amp;quot;Move left&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;moveRight&amp;quot; value=&amp;quot;Move right&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;input id=&amp;quot;Recenter&amp;quot; value=&amp;quot;Recenter&amp;quot; type=&amp;quot;button&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
  &amp;lt; /div&amp;gt;&lt;br /&gt;
 &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
    // DOM element where the Timeline will be attached&lt;br /&gt;
    var container = document.getElementById('visualization');&lt;br /&gt;
    // Create a DataSet (allows two way data-binding)&lt;br /&gt;
    var items = new vis.DataSet(visualization_JSON);&lt;br /&gt;
    // Configuration for the Timeline&lt;br /&gt;
    var options = {&lt;br /&gt;
        zoomMin: 1000 * 60 * 60 * 24,             // one day in milliseconds&lt;br /&gt;
        zoomMax: 1000 * 60 * 60 * 24 * 31 * 12     // about three months in milliseconds&lt;br /&gt;
    };&lt;br /&gt;
    // Create a Timeline&lt;br /&gt;
    var timeline = new vis.Timeline(container, items, options);&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several buttons that were inserted into the timeline to allow the user to interact with the timeline. The code for that is&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    var visualization_window=timeline.range.getRange();&lt;br /&gt;
    function move (percentage) {&lt;br /&gt;
        var range = timeline.getWindow();&lt;br /&gt;
        var interval = range.end - range.start;&lt;br /&gt;
        timeline.setWindow({&lt;br /&gt;
            start: range.start.valueOf() - interval * percentage,&lt;br /&gt;
            end:   range.end.valueOf()   - interval * percentage&lt;br /&gt;
        });&lt;br /&gt;
    }&lt;br /&gt;
    // attach events to the navigation buttons&lt;br /&gt;
    // zoom percentage in zoomin/zoomout can be adjusted below by passing paramenter. Similar is the case for move left/right along the x-axis&lt;br /&gt;
    document.getElementById('zoomIn').onclick    = function () { timeline.zoomIn( 0.2); };&lt;br /&gt;
    document.getElementById('zoomOut').onclick   = function () { timeline.zoomOut( 0.2); };&lt;br /&gt;
    document.getElementById('moveLeft').onclick  = function () { move( 0.2); };&lt;br /&gt;
    document.getElementById('moveRight').onclick = function () { move(-0.2); };&lt;br /&gt;
    document.getElementById('Recenter').onclick  = function () {&lt;br /&gt;
        var visualization_window_start = new Date(visualization_window.start);&lt;br /&gt;
        var visualization_window_end = new Date(visualization_window.end);&lt;br /&gt;
        timeline.setWindow(visualization_window_start, visualization_window_end, { animation: true });&lt;br /&gt;
    };&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functionality of each button is explained in the Program Design section above.&lt;br /&gt;
&lt;br /&gt;
It is necessary to obtain data from the Expertiza database to JSON format so that it can be processed by the timeline for visualization. After collecting the data from the database, processing it and storing it into a ruby variable, we use the JSON.parse() function to convert that information into JSON objects. To maintain continuity, the process of obtaining data and preprocessing it is explained later in the wiki. The code to convert the variable contents into a JSON object is as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;script&amp;gt;&lt;br /&gt;
    // converting @visualization_data array to javascript compatible JSON object&lt;br /&gt;
    var visualization_JSON = JSON.parse('&amp;lt;%=raw  @visualization_data.to_json%&amp;gt;');&lt;br /&gt;
    var href_JSON = JSON.parse('&amp;lt;%= @href_arr.to_json.html_safe%&amp;gt;')&lt;br /&gt;
    var temp;&lt;br /&gt;
    //temp is temporary variable used to generate hyperlinks from content&lt;br /&gt;
    for(i=0;  i&amp;lt;visualization_JSON.length; i++) {&lt;br /&gt;
        temp=visualization_JSON[i].content.split(&amp;quot;&amp;lt;split&amp;gt;&amp;quot;);&lt;br /&gt;
        if(href_JSON[i]=='')&lt;br /&gt;
            visualization_JSON[i].content = temp[0]+&amp;quot;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
        else&lt;br /&gt;
            visualization_JSON[i].content = &amp;quot;&amp;lt;a href=&amp;quot;+href_JSON[i]+&amp;quot; target='_blank'&amp;gt;&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;&amp;quot;+temp[0]+&amp;quot;&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;quot;+temp.slice(1);&lt;br /&gt;
    }&lt;br /&gt;
 &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following code is used to display due dates in the timeline. The types of due dates included are Round submission or Round review due date. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;% @href_arr= Array.new %&amp;gt;&lt;br /&gt;
 &amp;lt;! -- @href_arr is used to store all the hyperlinks for each visualized object --&amp;gt;&lt;br /&gt;
 &amp;lt;% @duedates = DueDate.where(&amp;quot;parent_id = #{@assignment.id}&amp;quot;)&lt;br /&gt;
   @visualization_data = @duedates.map do |due|&lt;br /&gt;
     @href_arr.push(&amp;quot;&amp;quot;);&lt;br /&gt;
     if due.deadline_type_id.eql? 1&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;submissionDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Submission due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     else&lt;br /&gt;
       { :id =&amp;gt; due.id, :start=&amp;gt; due.due_at, :className =&amp;gt; &amp;quot;reviewDue&amp;quot;, :content =&amp;gt; &amp;quot;Round &amp;quot;+(due.round.to_s)+&amp;quot;&amp;lt;split&amp;gt;Review due by &amp;quot;+'&amp;lt;br&amp;gt;'+due.due_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
     end&lt;br /&gt;
   end&lt;br /&gt;
 %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to add submission hyperlinks and files in the timeline. The code for that is &lt;br /&gt;
&lt;br /&gt;
 &amp;lt; ! -- display only if submissions are made--&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @team.nil?&lt;br /&gt;
     @submissions = SubmissionRecord.find_by_sql&amp;quot;select * from  submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and content NOT IN (select content from submission_records where assignment_id=#{@assignment.id} and team_id=#{@team.id} and UPPER(operation) Like 'REMOVE%')&amp;quot;&lt;br /&gt;
     @visualization_data += @submissions.map do |submission|&lt;br /&gt;
       #display_directory_tree(participant, files, true).html_safe&lt;br /&gt;
       if (submission.operation).eql?('Submit File')&lt;br /&gt;
         file = submission.content&lt;br /&gt;
         ret=&amp;quot;&amp;quot;&lt;br /&gt;
         if File.exist?(file) &amp;amp;&amp;amp; File.directory?(file)&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content', :action =&amp;gt; 'edit', :id =&amp;gt; participant.id, &amp;quot;current_folder[name]&amp;quot; =&amp;gt; file&lt;br /&gt;
         else&lt;br /&gt;
           ret += &amp;quot;\n      &amp;quot;&lt;br /&gt;
           ret += link_to File.basename(file), :controller =&amp;gt; 'submitted_content',&lt;br /&gt;
                          :action =&amp;gt; 'download',&lt;br /&gt;
                          :id =&amp;gt; @participant.id,&lt;br /&gt;
                          :download =&amp;gt; File.basename(file),&lt;br /&gt;
                          &amp;quot;current_folder[name]&amp;quot; =&amp;gt; File.dirname(file)&lt;br /&gt;
         end&lt;br /&gt;
         @href_arr.push(ret.split('&amp;quot;')[1])&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;fileUpload&amp;quot;, :content =&amp;gt; (submission.content).split('/')[-1]+'&amp;lt;split&amp;gt;'+submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       else&lt;br /&gt;
         @href_arr.push(submission.content)&lt;br /&gt;
         { :id =&amp;gt; submission.id, :start=&amp;gt; submission.created_at, :className=&amp;gt; &amp;quot;hyperlinkUpload&amp;quot; ,:content =&amp;gt; submission.content+'&amp;lt;split&amp;gt;'+submission.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' The following code fetches submission records of a student for a particular assignment from the '''submission_records''' table. Then after checking if the submission exists and when the type is a file, a hyperlink to the file's location path is obtained and pushed into the JSON. The same is done for a submission with the type Hyperlink.&lt;br /&gt;
&lt;br /&gt;
Then to get the peer reviews, self-reviews, feedback and team reviews, the following code is used. &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;! -- Reviews not yet started --&amp;gt;&lt;br /&gt;
 &amp;lt;% unless @review_mappings.nil?&lt;br /&gt;
     @review_mappings.each do |review_mapping_iterator|&lt;br /&gt;
       @response_values = Response.where(:map_id =&amp;gt; review_mapping_iterator.id)&lt;br /&gt;
       @visualization_data += @response_values.map do |response_value_iterator|&lt;br /&gt;
         if review_mapping_iterator.type==&amp;quot;ReviewResponseMap&amp;quot;&lt;br /&gt;
           review_mapping = ResponseMap.find(review_mapping_iterator.reviewed_object_id)&lt;br /&gt;
           participant = AssignmentTeam.get_first_member(review_mapping_iterator.reviewee_id)&lt;br /&gt;
           topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)&lt;br /&gt;
           if !topic_id.nil?&lt;br /&gt;
             if SignUpTopic.find(topic_id).topic_identifier != ''&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_identifier+&amp;quot;: &amp;quot;+SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             else&lt;br /&gt;
               @topic_name=SignUpTopic.find(topic_id).topic_name&lt;br /&gt;
             end&lt;br /&gt;
           end&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;review&amp;quot;, :content =&amp;gt; &amp;quot;Peer Review - Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt; Review for: #{@topic_name}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;SelfReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;selfReview&amp;quot;, :content =&amp;gt; &amp;quot;Self Feedback - Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Self Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         elsif review_mapping_iterator.type==&amp;quot;TeammateReviewResponseMap&amp;quot;&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             reviewee = ResponseMap.where(:reviewer_id =&amp;gt; &amp;quot;#{review_mapping_iterator.reviewer_id}&amp;quot;, :id =&amp;gt;&amp;quot;#{review_mapping_iterator.id}&amp;quot;).pluck(:reviewee_id)&lt;br /&gt;
             puts reviewee.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.reviewer_id.to_s+&amp;quot; &amp;quot;+review_mapping_iterator.id.to_s&lt;br /&gt;
             user_id = Participant.where(:id=&amp;gt; &amp;quot;#{reviewee[0]}&amp;quot;).pluck(:user_id)&lt;br /&gt;
             reviewee_name = User.where(:id=&amp;gt;&amp;quot;#{user_id[0]}&amp;quot;).pluck(:name)&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;teamReview&amp;quot;, :content =&amp;gt; &amp;quot;Team Review - Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Team review for #{reviewee_name[0]}&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         else&lt;br /&gt;
           unless response_value_iterator.nil? and response_value_iterator.is_submitted.zero?&lt;br /&gt;
             @href_arr.push(&amp;quot;../response/view?id=&amp;quot;+response_value_iterator.id.to_s)&lt;br /&gt;
             { :id =&amp;gt; response_value_iterator.id, :start=&amp;gt; response_value_iterator.created_at, :className =&amp;gt; &amp;quot;feedback&amp;quot;, :content =&amp;gt; &amp;quot;Feedback - Round &amp;quot;+response_value_iterator.round.to_s+&amp;quot;&amp;lt;split&amp;gt;Feedback&amp;quot;+'&amp;lt;br&amp;gt;'+response_value_iterator.created_at.strftime(&amp;quot;%m/%d/%Y at %I:%M %p&amp;quot;) }&lt;br /&gt;
           end&lt;br /&gt;
         end&lt;br /&gt;
       end&lt;br /&gt;
     end&lt;br /&gt;
   end %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Plan==&lt;br /&gt;
&lt;br /&gt;
Feature tests will be written to thoroughly test our modifications. A new file with the name &amp;lt;b&amp;gt;timestamps_for_students_submissions_spec.rb&amp;lt;/b&amp;gt; file will be created in &amp;lt;b&amp;gt;spec/features&amp;lt;/b&amp;gt; folder with various test cases to test the changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Edge Cases==&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student opens the view page of a newly created assignment'''&lt;br /&gt;
&lt;br /&gt;
* When the user has not made any submissions, reviews or feedbacks to reviews to the assignment, the timeline must only display the due dates of the assignment. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when student has not joined any team and makes submissions'''&lt;br /&gt;
&lt;br /&gt;
* When a student who is not part of any team makes a submission, he is assigned a team_ID by Expertiza and all submissions made by him are linked to that ID. So only those submissions will be displayed on the timeline. &lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when the student joins a team, what happens to the submissions he made before joining the team'''&lt;br /&gt;
&lt;br /&gt;
*  When he joins a team and he receives a new team_ID, any submissions made hereafter will be made under the new team_ID and all previous submissions made by the student will not be shown on the timeline(this is how Expertiza assigns team_IDs and submissions- the same is reflected in 'your work' section of a user's profile). Only the user submissions made after he joins the team is shown on the timeline.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when there is no name for a given assignment'''&lt;br /&gt;
&lt;br /&gt;
* Sometimes assignments are not named. In the peer review submission rectangular box displayed on the timeline after the student submits a peer review, instead of showing the label &amp;quot;Review for [assignment name]&amp;quot;, the label says &amp;quot;Review&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
'''Timeline behavior when a submitted hyperlink is removed'''&lt;br /&gt;
&lt;br /&gt;
* When a submitted hyperlink is removed, the submission must not be displayed on the timeline any more.&lt;br /&gt;
&lt;br /&gt;
==Future modifications== &lt;br /&gt;
&lt;br /&gt;
We can also include icons that are embedded into the rectangles. They act as visual aids to help the user quickly recognize the category of the box. We propose a design that would look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:S3.png]]&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111974</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111974"/>
		<updated>2017-11-06T05:29:16Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
== Test implementation ==&lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111973</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111973"/>
		<updated>2017-11-06T05:26:46Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
Git Original link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
Git Revised link&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza/tree/Bronzeproject&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Pattern Usage  ==&lt;br /&gt;
We implemented using the MVC (Model View Controller) pattern. We felt it was the pattern used in expertiza , usage of same pattern would be much easier.&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
In addition, we have also tested the initialization of VmQuestionResponseRow object with 5 parameters and 6 parameters to ensure the initialization process works as intended (see code).&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, the topic is fixing and modification on Expertize team score calculation mechanism. For this project, a meeting once every week for 2 weeks with TA was proceeded. The main focus for the first one and half week involves setting up the environment on the machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, which were solved through file tracing, problem identifying, and debugging. For the rest of these a little over 2 weeks period, several issues were identified with the project. The main issue for program include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, it was identified that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
The issue can be solved by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below (note: not_null_reviews.zero? check are used two times in order to pass the github check on coding, as combining these two lines into one (row_average_score = (row_average_score / not_null_reviews).round(2) unless not_null_reviews.zero?) would resulting in failing on github check, while the other solution which is putting both line into an unless block would not have any benefit execution efficiency wise).&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, several tests were performed for the model class modifications using RSpec, with some of the code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc, were used.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111781</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111781"/>
		<updated>2017-11-04T21:40:49Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Scenario */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error_1787.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Error_1787.png&amp;diff=111780</id>
		<title>File:Error 1787.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Error_1787.png&amp;diff=111780"/>
		<updated>2017-11-04T21:40:30Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111779</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=111779"/>
		<updated>2017-11-04T21:38:39Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Explanation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores are not calculated on dividing with total reviews given, instead calculated using total non null reviews given. &lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110352</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110352"/>
		<updated>2017-10-27T23:35:30Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110350</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110350"/>
		<updated>2017-10-27T23:35:10Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Snap of changes in code &lt;br /&gt;
&lt;br /&gt;
Comparison of code changes can be seen in Pull request.&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110336</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110336"/>
		<updated>2017-10-27T23:28:27Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Snap of changes in code &lt;br /&gt;
&lt;br /&gt;
Code after first modification -&lt;br /&gt;
&lt;br /&gt;
[[File:GIT_change_snap.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code after first modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
Code after second modification - &lt;br /&gt;
&lt;br /&gt;
[[File:code_2.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Code_2.png&amp;diff=110332</id>
		<title>File:Code 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Code_2.png&amp;diff=110332"/>
		<updated>2017-10-27T23:27:33Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110329</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110329"/>
		<updated>2017-10-27T23:25:45Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Snap of changes in code &lt;br /&gt;
&lt;br /&gt;
Code after first modification -&lt;br /&gt;
&lt;br /&gt;
[[File:GIT_change_snap.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec123.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec123.png&amp;diff=110326</id>
		<title>File:Rspec123.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec123.png&amp;diff=110326"/>
		<updated>2017-10-27T23:24:50Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: uploaded a new version of &amp;amp;quot;File:Rspec123.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec123.png&amp;diff=110323</id>
		<title>File:Rspec123.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspec123.png&amp;diff=110323"/>
		<updated>2017-10-27T23:20:38Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110317</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110317"/>
		<updated>2017-10-27T23:19:01Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Our Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Snap of changes in code &lt;br /&gt;
&lt;br /&gt;
Code after first modification -&lt;br /&gt;
&lt;br /&gt;
[[File:GIT_change_snap.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Rspec.png|center]]&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110314</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110314"/>
		<updated>2017-10-27T23:13:53Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
Pull request link&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Snap of changes in code &lt;br /&gt;
&lt;br /&gt;
Code after first modification -&lt;br /&gt;
&lt;br /&gt;
[[File:GIT_change_snap.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
(post code)&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110306</id>
		<title>CSC/ECE 517 Fall 2017/E1787 OSS project Bronze Score calculations</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2017/E1787_OSS_project_Bronze_Score_calculations&amp;diff=110306"/>
		<updated>2017-10-27T23:10:54Z</updated>

		<summary type="html">&lt;p&gt;Skatta3: /* Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This project involves revision of score calculation bug of Expertiza homework reviewing mechanism.&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
Sometimes when a reviewee of a project or homework fills out the review form, he or she may leave certain review question blank. When taken into score calculation for the project or homework, the application instead fills in 0 on blank answers. This behavior is incorrect as the blank review answers should never be used when used to calculate final score.&lt;br /&gt;
&lt;br /&gt;
Issue - &lt;br /&gt;
&lt;br /&gt;
[[File:error.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&lt;br /&gt;
Solution - &lt;br /&gt;
&lt;br /&gt;
[[File:Grades.png|center]]&lt;br /&gt;
&lt;br /&gt;
===Github Link===&lt;br /&gt;
*https://github.com/saiharsha1994/expertiza&lt;br /&gt;
&lt;br /&gt;
===Pull request Link===&lt;br /&gt;
*https://github.com/expertiza/expertiza/pull/1058&lt;br /&gt;
&lt;br /&gt;
===Explanation===&lt;br /&gt;
====Average Calculation====&lt;br /&gt;
The scores&lt;br /&gt;
&lt;br /&gt;
====Testing====&lt;br /&gt;
We have run unit test using RSpec and Carpybara. The test file path is spec/models/vm_question_response_row_spec.rb.&lt;br /&gt;
&lt;br /&gt;
For the test, we have identified 2 scenarios. First one is regarding correctness on average score calculation, where we will create a VmQuestionResponseRow object with sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average;&lt;br /&gt;
&lt;br /&gt;
Second one is regarding whether average score calculation includes nil values, where we will create a VmQuestionResponseRow object with one or more nil sample test scores inside and call its average_score_for_row method, then we match returned average to the expected average to check if nil is redefined and used in score calculation.&lt;br /&gt;
&lt;br /&gt;
==Our Work==&lt;br /&gt;
&lt;br /&gt;
For the OSS project, our topic is fixing and modification on Expertize team score calculation mechanism. For this project, we have meet once every week for 2 weeks either with TA. For the first one and half week, each of us has set up the environment on our machine. Some of notable issues on setting up include theRubyRacer dependency problem on project, Node packages not recognized by rails (Windows), Font-Awesome-Rails path issues, etc, and we worked together to identify the issues and finding ways to get around them. For the rest of these a little over 2 weeks period, we have identified several issues with our project. The main issue for our part include the false score calculation mechanism by expertiza where empty scores are assumed automatically to 0 and included in calculation; this would in turn give a false score calculation result as empty scores are not supposed to be set to 0 and then included in for calculation. Through debugging and defining the problem, we found that the reason for such issue involves average_score_for_row method in vm_question_response_row.rb in model as shown below in red - where the row_average_score dividend was not been used correctly.&lt;br /&gt;
&lt;br /&gt;
Snap of changes in code &lt;br /&gt;
&lt;br /&gt;
Code after first modification -&lt;br /&gt;
&lt;br /&gt;
[[File:GIT_change_snap.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
We proceeded to solve the issue by modify the calculation for dividend using a counter to exclude nil values and modified the constructor for VmQuestionResponseRow classs that it can dynamically accept 5 or 6 parameters, as shown below:&lt;br /&gt;
&lt;br /&gt;
Code - &lt;br /&gt;
&lt;br /&gt;
[[File:code.png|1047px|thumb|center]]&lt;br /&gt;
&lt;br /&gt;
The first modification was done as it fix the issue while keep code at its most simplicity; (As shown in screen shot)&lt;br /&gt;
&lt;br /&gt;
The second modification was done to accommodate the scenario where if specific score given is over certain upper-limit x or lower-limit y, the score will be automatically reset to x or y accordingly so that the score will alway be in between x and y. &lt;br /&gt;
&lt;br /&gt;
Afterward, we have testing the model class modifications using RSpec, with code as shown below:&lt;br /&gt;
&lt;br /&gt;
(post code)&lt;br /&gt;
&lt;br /&gt;
For this project, we have used techniques such as Unit testing, constructor overloading, and technologies such as bower, carpybara, RSpec, etc.&lt;/div&gt;</summary>
		<author><name>Skatta3</name></author>
	</entry>
</feed>