<?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=Agoel4</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=Agoel4"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Agoel4"/>
	<updated>2026-08-20T11:26:47Z</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_2016/E1675._Timestamp_for_student_file_%26_hyperlink_submissions&amp;diff=104194</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=104194"/>
		<updated>2016-11-03T04:11:00Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* Task Goals */&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;
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;
===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>Agoel4</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=104147</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=104147"/>
		<updated>2016-10-31T21:57:33Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* 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 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 Interactive Video 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>Agoel4</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=104146</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=104146"/>
		<updated>2016-10-31T21:56:58Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* 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 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>Agoel4</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=104145</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=104145"/>
		<updated>2016-10-31T21:56:18Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* 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 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;
Below is a DEMO video which depicts how the project was testing 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>Agoel4</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=104007</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=104007"/>
		<updated>2016-10-29T22:51:42Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* 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 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;
Below is a DEMO video which depicts how the project was testing using the User Interface. &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>Agoel4</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=104006</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=104006"/>
		<updated>2016-10-29T22:51:04Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* E1675.Timestamp for student file &amp;amp; hyperlink submissions */&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;
Below is a DEMO video which depicts how the project was testing using the User Interface. &lt;br /&gt;
#[https://youtu.be/cGXu1YPG0Ec Demo link]&lt;br /&gt;
&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>Agoel4</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=104004</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=104004"/>
		<updated>2016-10-29T22:32:40Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* Automated Testing using RSPEC */&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 project is 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;
===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 students' submission. In this project you are required to keep track of timestamp records for students' submissions and updates of artifacts (submitted files or hyperlinks). Authors can delete or re-submit files and hyperlinks too, you should also have those activities 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 finish the function for 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 what occured, 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;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Action_allowed=====&lt;br /&gt;
* In present code, the application has right control to decide which kind of user could have access to the specific page. In order to let instructor see the submission_record, we need to add action_allowed method in submission_record_controller. Codes are here.&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 find the previous page for students to submitted their hyperlinks and files which are in submitted_content. And we add codes to fill in submission_record table once a hyperlink or file is submitted.&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;
&lt;br /&gt;
&lt;br /&gt;
===== Remove Hyperlink or File=====&lt;br /&gt;
* When students want to delete their hyperlinks or files submitted before, the data in submission_record table should not disappear. What we want are all operations made by the team. As a result, we add specific code in the original 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 exist hyperlinks clickable, we will choose whose operation 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 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;
===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;
===Testing from UI===&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>Agoel4</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=104003</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=104003"/>
		<updated>2016-10-29T22:26:36Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* Automated Testing using RSPEC */&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 project is 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;
===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 students' submission. In this project you are required to keep track of timestamp records for students' submissions and updates of artifacts (submitted files or hyperlinks). Authors can delete or re-submit files and hyperlinks too, you should also have those activities 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 finish the function for 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 what occured, 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;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Action_allowed=====&lt;br /&gt;
* In present code, the application has right control to decide which kind of user could have access to the specific page. In order to let instructor see the submission_record, we need to add action_allowed method in submission_record_controller. Codes are here.&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 find the previous page for students to submitted their hyperlinks and files which are in submitted_content. And we add codes to fill in submission_record table once a hyperlink or file is submitted.&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;
&lt;br /&gt;
&lt;br /&gt;
===== Remove Hyperlink or File=====&lt;br /&gt;
* When students want to delete their hyperlinks or files submitted before, the data in submission_record table should not disappear. What we want are all operations made by the team. As a result, we add specific code in the original 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 exist hyperlinks clickable, we will choose whose operation 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 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;
===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;
* RSpec&lt;br /&gt;
* Factory Girl ruby gem&lt;br /&gt;
* 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 assingment 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;
===Testing from UI===&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>Agoel4</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=104002</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=104002"/>
		<updated>2016-10-29T22:25:56Z</updated>

		<summary type="html">&lt;p&gt;Agoel4: /* Automated Testing using RSPEC */&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 project is 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;
===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 students' submission. In this project you are required to keep track of timestamp records for students' submissions and updates of artifacts (submitted files or hyperlinks). Authors can delete or re-submit files and hyperlinks too, you should also have those activities 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 finish the function for 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 what occured, 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;
&lt;br /&gt;
===Implementation===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Action_allowed=====&lt;br /&gt;
* In present code, the application has right control to decide which kind of user could have access to the specific page. In order to let instructor see the submission_record, we need to add action_allowed method in submission_record_controller. Codes are here.&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 find the previous page for students to submitted their hyperlinks and files which are in submitted_content. And we add codes to fill in submission_record table once a hyperlink or file is submitted.&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;
&lt;br /&gt;
&lt;br /&gt;
===== Remove Hyperlink or File=====&lt;br /&gt;
* When students want to delete their hyperlinks or files submitted before, the data in submission_record table should not disappear. What we want are all operations made by the team. As a result, we add specific code in the original 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 exist hyperlinks clickable, we will choose whose operation 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 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;
===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;
* RSpec&lt;br /&gt;
* Factory Girl ruby gem&lt;br /&gt;
* 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;
&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 assingment 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;
&lt;br /&gt;
===Testing from UI===&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>Agoel4</name></author>
	</entry>
</feed>