Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2023 2 Track the time students look at other submissions #1728

Merged
merged 42 commits into from Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
40be5cd
initial commit
Apr 18, 2020
70fe48b
try to fix travis CI build
Apr 20, 2020
2282868
Added start time function to response.html.erb
leroyboy12 Apr 20, 2020
61f824c
removal of accidental whitespaces in response.html.erb
leroyboy12 Apr 20, 2020
7f3c329
Added end time function to response.html.erb
leroyboy12 Apr 20, 2020
2e534a6
Added set inerval to jQuery
leroyboy12 Apr 20, 2020
f7c0203
Initial commit
Apr 20, 2020
6983933
added JS logic to submitted files erb for marking time of external files
littlekahunalifts Apr 20, 2020
3c67df9
Fixed travis CI error
Apr 20, 2020
2d04ce2
added submissionViewingEvents model
Apr 20, 2020
ec65e7a
push model autogenerated files
Apr 20, 2020
7bcbd26
added SubmissionViewingEvents controller
Apr 20, 2020
0586c23
added methods to SubmissionViewingEvents controller
Apr 20, 2020
fc20476
edited routes to ahve route for viewing external links
littlekahunalifts Apr 20, 2020
fd52216
Merge branch 'E2023_2' of https://github.com/jamcdon3/expertiza into …
littlekahunalifts Apr 20, 2020
53d0ee7
added to routes for viewing external link times
littlekahunalifts Apr 20, 2020
0f53573
reverted response_controller.rb for travis
littlekahunalifts Apr 21, 2020
d9e0b27
redoing changes for submitted_content/_main.html.erb
littlekahunalifts Apr 21, 2020
d67c6ef
Addition of hidden field tags for form in response.html.erb
leroyboy12 Apr 21, 2020
f75a1f6
Added submission check to ensure reviewer is still working on review
leroyboy12 Apr 21, 2020
ac0d5b3
Added logic to set submission check to false in view.html.erb
leroyboy12 Apr 21, 2020
1a72cd8
Created submission vieiwing events index page
leroyboy12 Apr 21, 2020
ecb8232
Created edit view form submission viewing events controller
leroyboy12 Apr 21, 2020
6909264
Created partial form for submission viewing events controller
leroyboy12 Apr 21, 2020
ad042ca
edited views/submitted_content/_hyperlink...erb to ensure users click…
littlekahunalifts Apr 21, 2020
ae749a0
made changes to _review_report to reflect changes in reports_controller
Sattlert2 Apr 22, 2020
d9c229e
added a viewer for reports controller
Sattlert2 Apr 22, 2020
fdb91d5
Replaced line 55 in view_review_scores_popup to find the team through…
Sattlert2 Apr 22, 2020
321257b
updated line 32 to incorporate file link from class
Sattlert2 Apr 22, 2020
a5c7bbf
created show.html.haml for submission viewing events to enable dynami…
Sattlert2 Apr 22, 2020
35657ed
Created new.html.haml for submission_viewing_events to enable dynamic…
Sattlert2 Apr 22, 2020
121ea10
delete autogenerated minitest files - not used in experiza
Apr 22, 2020
641bb62
remove not used autogenerated files from controller
Apr 22, 2020
b30d734
creat controller rspec and test record_start_time method
Apr 23, 2020
85e7bbe
updated rspec and added record_end_time test
Apr 23, 2020
3a080e8
update rspec and added mark_end_time test
Apr 23, 2020
3a0fd89
added embedded function for tracking window times
Apr 24, 2020
2fc8d14
fix typo
Apr 24, 2020
e227af7
Merge branch 'beta' into E2023_2
adityag3 Jun 24, 2020
67a937a
Updated travis.yml
Saurabh110 Jun 24, 2020
e037bf7
Revert travis.yml update
Saurabh110 Jun 24, 2020
086ea8b
Updated schema.rb
Saurabh110 Jun 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/controllers/response_controller.rb
Expand Up @@ -105,7 +105,11 @@ def edit
# Update the response and answers when student "edit" existing response
def update
render nothing: true unless action_allowed?


# the response to be updated
@response = Response.find(params[:id])
@current_round = @response.round

msg = ""
begin
# the response to be updated
Expand Down Expand Up @@ -330,6 +334,7 @@ def assign_instance_vars
@header = 'Edit'
@next_action = 'update'
@response = Response.find(params[:id])
@current_round = @response.round
@map = @response.map
@contributor = @map.contributor
when 'new'
Expand Down
75 changes: 75 additions & 0 deletions app/controllers/submission_viewing_events_controller.rb
@@ -0,0 +1,75 @@
class SubmissionViewingEventsController < ApplicationController
def action_allowed?
true
end

# record time when link or file is opened in new window
def record_start_time
param_args = params[:submission_viewing_event]
# check if this link is already opened and timed
submission_viewing_event_records = SubmissionViewingEvent.where(map_id: param_args[:map_id], round: param_args[:round], link: param_args[:link])
# if opened, end these records with current time
if submission_viewing_event_records
submission_viewing_event_records.each do |time_record|
if time_record.end_at.nil?
# time_record.update_attribute('end_at', start_at)
time_record.destroy
end
end
end
# create new response time record for current link
submission_viewing_event = SubmissionViewingEvent.new(submission_viewing_event_params)
submission_viewing_event.save

#if creating start time for expertiza update end times for all other links.
if param_args[:link]=='Expertiza Review'
params[:submission_viewing_event][:link] = nil
params[:submission_viewing_event][:end_at] = params[:submission_viewing_event][:start_at]
record_end_time()
end
render nothing: true
end

# record time when link or file window is closed
def record_end_time
data = params.require(:submission_viewing_event)
if data[:link].nil?
submission_viewing_event_records = SubmissionViewingEvent.where(map_id: data[:map_id], round: data[:round], end_at: nil).where.not(link: "Expertiza Review")
else
submission_viewing_event_records = SubmissionViewingEvent.where(map_id: data[:map_id], round: data[:round], link: data[:link])
end
submission_viewing_event_records.each do |time_record|
if time_record.end_at.nil?
time_record.update_attribute('end_at', data[:end_at])
# break
end
end
respond_to do |format|
format.json { head :no_content }
end
end

# mark end_at review time for all uncommited links/files
def mark_end_time
data = params.require(:submission_viewing_event)
@link_array = []
submission_viewing_event_records = SubmissionViewingEvent.where(map_id: data[:map_id], round: data[:round])
submission_viewing_event_records.each do |submissionviewingevent_entry|
if submissionviewingevent_entry.end_at.nil?
@link_array.push(submissionviewingevent_entry.link)
submissionviewingevent_entry.update_attribute('end_at', data[:end_at])
end
end
respond_to do |format|
format.json { render json: @link_array }
end
end

private

# Only allow a trusted parameter "white list" through.
def submission_viewing_event_params
params.require(:submission_viewing_event).permit(:map_id, :round, :link, :start_at, :end_at)
end

end
6 changes: 5 additions & 1 deletion app/controllers/tree_display_controller.rb
Expand Up @@ -213,10 +213,14 @@ def children_node_ng
flash[:error] = "Invalid JSON in the TreeList" unless json_valid? params[:reactParams][:child_nodes]
child_nodes = child_nodes_from_params(params[:reactParams][:child_nodes])
Saurabh110 marked this conversation as resolved.
Show resolved Hide resolved
tmp_res = {}
unless child_nodes.blank?

begin
child_nodes.each do |node|
initialize_fnode_update_children(params, node, tmp_res)
end
flash[:error] = "Invalid child nodes in the TreeList"
rescue

end
res = res_node_for_child(tmp_res)
res['Assignments'] = res['Assignments'].sort_by {|x| [x['instructor'], -1 * x['creation_date'].to_i] } if res.key?('Assignments')
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/submission_viewing_events_helper.rb
@@ -0,0 +1,2 @@
module SubmissionViewingEventsHelper
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto generated file from 'rails generate controller' - not used

end
12 changes: 7 additions & 5 deletions app/helpers/submitted_content_helper.rb
Expand Up @@ -24,11 +24,13 @@ def display_directory_tree(participant, files, display_to_reviewer_flag)
ret += link_to File.basename(file), :controller => 'submitted_content', :action => 'edit', :id => participant.id, "current_folder[name]" => file
else
ret += "\n "
ret += link_to File.basename(file), :controller => 'submitted_content',
:action => 'download',
:id => participant.id,
:download => File.basename(file),
"current_folder[name]" => File.dirname(file)
ret += link_to File.basename(file), {:controller => 'submitted_content',
:action => 'download',
:id => participant.id,
:download => File.basename(file),
"current_folder[name]" => File.dirname(file)},
:class => "fileLink",
:download => File.basename(file).to_s
end
ret += "\n </td>\n <td valign = top>\n"
ret += File.size(file).to_s
Expand Down
2 changes: 2 additions & 0 deletions app/models/submission_viewing_event.rb
@@ -0,0 +1,2 @@
class SubmissionViewingEvent < ActiveRecord::Base
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

model file auto generated with 'rails generate model' - not used currently but may be helpful for future work with data table

end
5 changes: 3 additions & 2 deletions app/views/popup/view_review_scores_popup.html.erb
Expand Up @@ -52,8 +52,9 @@
<% answer = Answer.where(response_id: response_id, question_id: question.id).first %>
<% if !answer.nil? %>
<tr>
<% team = Team.find(ResponseMap.find(Response.find(response_id).map_id).reviewee_id) %>
<% #TODO does this one need reviewer fixed? %>>
<% index = ResponseMap.find(Response.find(response_id).map_id).reviewee_id %>
<% team = Team.find(index)%>

<% response_map = ReviewResponseMap.where(reviewed_object_id: @assignment_id,
reviewer_id: @reviewer_id,
reviewee_id: team.id).last %>
Expand Down
6 changes: 5 additions & 1 deletion app/views/reports/_review_report.html.erb
@@ -1,3 +1,4 @@
<% @l = -1 %>
<!-- the table creation is changed top accommodate functionality of tablesorter, which requires thead and tbody seperately. Previously, headers were in tbody only -->
<div class='reviewreport'>
<!-- Added headers for tablesorter -->
Expand Down Expand Up @@ -48,7 +49,7 @@
</tr>
</thead>
<tbody>

<% timeHash = Hash.new %>
<% sort_reviewer_by_review_volume_desc.each do |r| %>
<% @response_maps, @rspan = get_data_for_review_report(@id, r.id, @type) %>
<tr>
Expand Down Expand Up @@ -98,6 +99,9 @@
</div>
</div>

<!--Display total time spent on reviewing as a hyperlink to popup which shows the breakdown of time spent between expertiza and other links as piechart-->
<%= render partial: 'review_submissions_time_spent', locals: {bgcolor: @bgcolor, map_id: ri.id,id: r.id, reviewee_id: ri.reviewee_id, timeHash: timeHash} %>

<!--Author feedback-->
<!--Dr.Kidd required to add a "author feedback" column that shows the average score the reviewers received from the authors. In this case, she can see all the data on a single screen.-->
<!--Dr.Kidd's course-->
Expand Down