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

E1677: Text Metrics Project #892

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions app/assets/javascripts/review_metrics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/review_metrics.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the review_metrics controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
73 changes: 73 additions & 0 deletions app/assets/stylesheets/scaffolds.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;

&:visited {
color: #666;
}

&:hover {
color: #fff;
background-color: #000;
}
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;

h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}

ul li {
font-size: 12px;
list-style: square;
}
}
44 changes: 43 additions & 1 deletion app/controllers/popup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def action_allowed?
['Super-Administrator',
'Administrator',
'Instructor',
'Teaching Assistant'].include? current_role_name
'Teaching Assistant','Student'].include? current_role_name
end

# this can be called from "response_report" by clicking student names from instructor end.
Expand Down Expand Up @@ -119,4 +119,46 @@ def reviewer_details_popup
@user = User.find(@userid)
@id = params[:assignment_id]
end
# this can be called from "response_report" by clicking on the View Metrics.
def view_review_metrics_popup
@reviewerid = params[:reviewer_id]
@assignment_id = params[:assignment_id]
@metrics = ReviewMetric.calculate_metrics_for_instructor(@assignment_id, @reviewerid)
@average_volume_per_round = Hash.new()
@average_suggestion_per_round = Hash.new()
@average_problem_per_round = Hash.new()
@average_offensive_per_round = Hash.new()
@metrics.each do |key, values|
volume = 0
count = 0
s = 0
pr = 0
o = 0
values.each do |v|
volume += v[2]
if v[3]
s += 1
end
if v[4]
pr += 1
end
if v[5]
o += 1
end
count += 1
end
@average_volume_per_round[key] = (volume.fdiv(count)).round(2)
@average_suggestion_per_round[key] = (s.fdiv(count)).round(2) * 100
@average_problem_per_round[key] = (pr.fdiv(count)).round(2) * 100
@average_offensive_per_round[key] = (o.fdiv(count)).round(2) * 100
end
# puts @average_volume_per_round
end
def view_student_review_metrics_popup
@response_id = params[:response_id]
@answers = ReviewMetric.calculate_metrics_for_student(@response_id)

end


end
58 changes: 58 additions & 0 deletions app/controllers/review_metrics_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
class ReviewMetricsController < ApplicationController
before_action :set_review_metric, only: [:show, :edit, :update, :destroy]

# GET /review_metrics
def index
@review_metrics = ReviewMetric.all
end

# GET /review_metrics/1
def show
end

# GET /review_metrics/new
def new
@review_metric = ReviewMetric.new
end

# GET /review_metrics/1/edit
def edit
end

# POST /review_metrics
def create
@review_metric = ReviewMetric.new(review_metric_params)

if @review_metric.save
redirect_to @review_metric, notice: 'Review metric was successfully created.'
else
render :new
end
end

# PATCH/PUT /review_metrics/1
def update
if @review_metric.update(review_metric_params)
redirect_to @review_metric, notice: 'Review metric was successfully updated.'
else
render :edit
end
end

# DELETE /review_metrics/1
def destroy
@review_metric.destroy
redirect_to review_metrics_url, notice: 'Review metric was successfully destroyed.'
end

private
# Use callbacks to share common setup or constraints between actions.
def set_review_metric
@review_metric = ReviewMetric.find(params[:id])
end

# Only allow a trusted parameter "white list" through.
def review_metric_params
params.require(:review_metric).permit(:response_id, :volume, :suggestion, :problem, :offensive_term)
end
end