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

E2164. Heatgrid fixes and improvements #2125

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
947d64c
Initial Empty Commit to track PR
Oct 29, 2021
3f0a2c1
Added a dropdown field for metric in General Tab
Nov 23, 2021
aee66ca
Updated field names in the metric dropdown
Nov 23, 2021
f6808cc
Add heatgrid_metric column in assignments table
Nov 23, 2021
bfa0a68
Merge pull request #1 from ShlokSayani/hvudeshi_beta
hvudeshi Nov 23, 2021
a137a75
Merge branch 'beta' of https://github.com/ShlokSayani/expertiza into …
Nov 23, 2021
fe19b30
Added switch case in the heatgrid view
Nov 23, 2021
6fa75d4
Updated metric name to countofcomments
Nov 23, 2021
6cedf37
Change in default value of the heatgrid-metric
Nov 23, 2021
d7df717
Merge pull request #3 from ShlokSayani/hvudeshi_beta
hvudeshi Nov 23, 2021
be7f48c
Merge branch 'beta' of https://github.com/ShlokSayani/expertiza into …
Nov 23, 2021
c6bcb58
Removed extra dropdown option
Nov 23, 2021
f868ef5
Merge pull request #2 from ShlokSayani/shlok/add_metric_dropdown
ShlokSayani Nov 23, 2021
82c6e29
Added null option in metric dropdown.
Nov 29, 2021
c78712d
Updated comment count dropdown name
Nov 29, 2021
b505f66
Added tests to check default value of metric dropdown
Nov 29, 2021
8d9399a
Added test to verify that none value can be selected
Nov 29, 2021
4db6142
Add test case for assignment creation controller with countofcomments…
Nov 29, 2021
101b6ff
Add capybara test case to expect the countofcomments dropdown
Nov 29, 2021
9935064
Update capybara test case for countofcomments dropdown
Nov 29, 2021
7e48c9e
Merge pull request #4 from ShlokSayani/hvudeshi_beta
ShlokSayani Nov 29, 2021
0771cd1
Merge pull request #5 from ShlokSayani/shlok/add_metric_dropdown
ShlokSayani Nov 29, 2021
dff755d
change in capybara test case for assignment creation
Nov 29, 2021
05c380a
Change in capybara test case
Nov 29, 2021
779aec8
Merge pull request #6 from ShlokSayani/hvudeshi_beta
hvudeshi Nov 29, 2021
c6b1732
Updated metric column header name
Nov 29, 2021
cf62402
Merge branch 'beta' of https://github.com/ShlokSayani/expertiza into …
Nov 29, 2021
f67f6c1
Updated heatgrid metric dropdown option
Nov 29, 2021
b06070d
Updated metric selection option
Nov 29, 2021
b5cd87c
Merge pull request #7 from ShlokSayani/shlok/add_metric_dropdown
ShlokSayani Nov 29, 2021
23a13f2
Added test to check for null dropdown value
Nov 30, 2021
dd02110
Merge pull request #8 from ShlokSayani/shlok/add_metric_dropdown
ShlokSayani Nov 30, 2021
778f2c0
Updated the default value of vary_by_round
Nov 30, 2021
d145773
Merge pull request #9 from ShlokSayani/shlok/add_metric_dropdown
ShlokSayani Nov 30, 2021
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: 7 additions & 0 deletions app/views/assignments/edit/_general.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ function microtaskChanged() {
<%= label_tag('assignment_form[assignment][availability_flag]', 'Available to students?') %>
</td>
</tr>

<tr>
<td style='padding:5px' id='assignment_metrics_field'>
<%= label_tag('assignment_form[assignment][heatgrid_metric]', 'Select a Metric to be displayed in the Report Heatgrid:') %>
<%= select('assignment_form[assignment]', 'heatgrid_metric', [['--', ''], %w[Verbose-Comment-Count countofcomments]], { :selected => @assignment_form.assignment.heatgrid_metric}, { :class => 'form-control', :style => 'width: 100px'}) %>
</td>
</tr>
</table>


Expand Down
24 changes: 17 additions & 7 deletions app/views/grades/view_team.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</table>
</div>

<!-- display the table title and tooltips -->
<!-- display the table title and tooltips -->
<span style="width:100%;">
<h4 style="display:inline-block;"><%= vm.questionnaire_display_type %>
<% if vm.questionnaire_type == "ReviewQuestionnaire" %>
Expand Down Expand Up @@ -129,9 +129,14 @@
<th class="sorter-true" align="right" >
Avg<span></span>
</th>
<th class="sorter-false">
<span data-toggle="tooltip" data-placement="right" title="A count of comments, for the respective question, which have word count > 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.">metric-1</span>
</th>

<% case @assignment.heatgrid_metric %>
<% when 'countofcomments' %>
<th class="sorter-false">
<span data-toggle="tooltip" data-placement="right" title="A count of comments, for the respective question, which have word count > 10. The purpose of this metric is to represent how many comments for the question are of a substantial length to provide quality feedback.">Verbose Comment Count</span>
</th>
<%end%>

</tr>
</thead>

Expand Down Expand Up @@ -164,9 +169,14 @@
<td class = 'cf' align="right">
<%= row.average_score_for_row.to_s %>
</td>
<td class = 'cf' align="center">
<%= row.countofcomments.to_s %>
</td>

<% case @assignment.heatgrid_metric %>
<% when 'countofcomments' %>
<td class = 'cf' align="center">
<%= row.countofcomments.to_s %>
</td>
<%end%>

</tr>
<!--loop that creates the collapsed-by-default row, which lists all comments. -->
<tr class="tablesorter-childRow">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddHeatgridMetricToAssignments < ActiveRecord::Migration
def change
add_column :assignments, :heatgrid_metric, :string, default: 'countofcomments'
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class UpdateVaryByRoundToAssignments < ActiveRecord::Migration
def change
change_column :assignments, :vary_by_round, :boolean, :default => true
end
end
27 changes: 14 additions & 13 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20210422185445) do
ActiveRecord::Schema.define(version: 20211123104746) do

create_table "account_requests", force: :cascade do |t|
t.string "name", limit: 255
Expand Down Expand Up @@ -79,17 +79,17 @@
t.datetime "updated_at"
t.string "name", limit: 255
t.string "directory_path", limit: 255
t.integer "submitter_count", limit: 4, default: 0, null: false
t.integer "submitter_count", limit: 4, default: 0, null: false
t.integer "course_id", limit: 4, default: 0
t.integer "instructor_id", limit: 4, default: 0
t.boolean "private", default: false, null: false
t.integer "num_reviews", limit: 4, default: 3, null: false
t.integer "num_review_of_reviews", limit: 4, default: 0, null: false
t.integer "num_review_of_reviewers", limit: 4, default: 0, null: false
t.boolean "private", default: false, null: false
t.integer "num_reviews", limit: 4, default: 3, null: false
t.integer "num_review_of_reviews", limit: 4, default: 0, null: false
t.integer "num_review_of_reviewers", limit: 4, default: 0, null: false
t.boolean "reviews_visible_to_all"
t.integer "num_reviewers", limit: 4, default: 0, null: false
t.integer "num_reviewers", limit: 4, default: 0, null: false
t.text "spec_location", limit: 65535
t.integer "max_team_size", limit: 4, default: 0, null: false
t.integer "max_team_size", limit: 4, default: 0, null: false
t.boolean "staggered_deadline"
t.boolean "allow_suggestions"
t.integer "days_between_submissions", limit: 4
Expand All @@ -100,12 +100,12 @@
t.integer "rounds_of_reviews", limit: 4, default: 1
t.boolean "microtask", default: false
t.boolean "require_quiz"
t.integer "num_quiz_questions", limit: 4, default: 0, null: false
t.integer "num_quiz_questions", limit: 4, default: 0, null: false
t.boolean "is_coding_assignment"
t.boolean "is_intelligent"
t.boolean "calculate_penalty", default: false, null: false
t.boolean "calculate_penalty", default: false, null: false
t.integer "late_policy_id", limit: 4
t.boolean "is_penalty_calculated", default: false, null: false
t.boolean "is_penalty_calculated", default: false, null: false
t.integer "max_bids", limit: 4
t.boolean "show_teammate_reviews"
t.boolean "availability_flag", default: true
Expand All @@ -130,6 +130,7 @@
t.boolean "reviewer_is_team"
t.boolean "is_conference_assignment", default: false
t.boolean "auto_assign_mentor", default: false
t.string "heatgrid_metric", limit: 255, default: "countofcomments"
end

add_index "assignments", ["course_id"], name: "fk_assignments_courses", using: :btree
Expand Down Expand Up @@ -269,7 +270,7 @@
t.string "queue", limit: 255
end

add_index "delayed_jobs", %w[priority run_at], name: "delayed_jobs_priority", using: :btree
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree

create_table "due_dates", force: :cascade do |t|
t.datetime "due_at"
Expand Down Expand Up @@ -800,7 +801,7 @@
t.datetime "created_at"
end

add_index "versions", %w[item_type item_id], name: "index_versions_on_item_type_and_item_id", using: :btree
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree

add_foreign_key "answer_tags", "answers"
add_foreign_key "answer_tags", "tag_prompt_deployments"
Expand Down
61 changes: 61 additions & 0 deletions spec/controllers/assignments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,66 @@
end
end

describe '#create with countofcomments' do
before(:each) do
allow(AssignmentForm).to receive(:new).with(any_args).and_return(assignment_form)
@params = {
button: '',
assignment_form: {
assignment_questionnaire: [{"assignment_id" => "1", "questionnaire_id" => "666", "dropdown" => "true",
"questionnaire_weight" => "100", "notification_limit" => "15", "used_in_round" => "1"}],
due_date: [{"id" => "", "parent_id" => "", "round" => "1", "deadline_type_id" => "1", "due_at" => "2017/12/05 00:00", "submission_allowed_id" => "3", "review_allowed_id" => "1", "teammate_review_allowed_id" => "3", "review_of_review_allowed_id" => "1", "threshold" => "1"},
{"id" => "", "parent_id" => "", "round" => "1", "deadline_type_id" => "2", "due_at" => "2017/12/02 00:00", "submission_allowed_id" => "1", "review_allowed_id" => "3", "teammate_review_allowed_id" => "3", "review_of_review_allowed_id" => "1", "threshold" => "1"}],
assignment: {
instructor_id: 2,
course_id: 1,
max_team_size: 1,
id: 1,
name: 'test assignment',
directory_path: '/test',
spec_location: '',
private: false,
show_teammate_reviews: false,
require_quiz: false,
num_quiz_questions: 0,
staggered_deadline: false,
microtask: false,
reviews_visible_to_all: false,
is_calibrated: false,
availability_flag: true,
reputation_algorithm: 'Lauw',
heatgrid_metric: 'countofcomments',
simicheck: -1,
simicheck_threshold: 100
}
}
}
end
context 'when assignment_form is saved successfully' do
it 'redirects to assignment#edit page' do
allow(assignment_form).to receive(:assignment).and_return(assignment)
allow(assignment_form).to receive(:save).and_return(true)
allow(assignment_form).to receive(:update).with(any_args).and_return(true)
allow(assignment_form).to receive(:create_assignment_node).and_return(double('node'))
allow(assignment).to receive(:id).and_return(1)
allow(Assignment).to receive(:find_by).with(id: 1).and_return(assignment)
allow_any_instance_of(AssignmentsController).to receive(:undo_link)
.with('Assignment "test assignment" has been created successfully. ').and_return(true)
post :create, @params
expect(response).to redirect_to('/assignments/1/edit')
end
end

context 'when assignment_form is not saved successfully' do
it 'renders assignment#new page' do
allow(assignment_form).to receive(:save).and_return(false)
post :create, @params
expect(response).to render_template(:new)
end
end
end


describe '#edit' do
context 'when assignment has staggered deadlines' do
it 'shows an error flash message and renders edit page' do
Expand Down Expand Up @@ -246,6 +306,7 @@
is_calibrated: false,
availability_flag: true,
reputation_algorithm: 'Lauw',
heatgrid_metric: 'countofcomments',
simicheck: -1,
simicheck_threshold: 100
}
Expand Down
58 changes: 58 additions & 0 deletions spec/features/assignment_creation_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,64 @@
)
end

it "is able to create a public assignment with countofcomments metric" do
login_as("instructor6")
visit "/assignments/new?private=0"

fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
select('Course 2', from: 'assignment_form_assignment_course_id')
fill_in 'assignment_form_assignment_directory_path', with: 'testDirectory'
fill_in 'assignment_form_assignment_spec_location', with: 'testLocation'
check("assignment_form_assignment_microtask")
check("assignment_form_assignment_reviews_visible_to_all")
check("assignment_form_assignment_is_calibrated")
uncheck("assignment_form_assignment_availability_flag")
expect(page).to have_select("assignment_form[assignment][reputation_algorithm]", options: %w[-- Hamer Lauw])
select "Verbose-Comment-Count", from: 'countsofcomment'

click_button 'Create'
assignment = Assignment.where(name: 'public assignment for test').first
expect(assignment).to have_attributes(
name: 'public assignment for test',
course_id: Course.find_by(name: 'Course 2').id,
directory_path: 'testDirectory',
spec_location: 'testLocation',
microtask: true,
is_calibrated: true,
availability_flag: false,
heatgrid_metric: 'countofcomments'
)
end

it "is able to create a public assignment with no metrics expected" do
login_as("instructor6")
visit "/assignments/new?private=0"

fill_in 'assignment_form_assignment_name', with: 'public assignment for test'
select('Course 2', from: 'assignment_form_assignment_course_id')
fill_in 'assignment_form_assignment_directory_path', with: 'testDirectory'
fill_in 'assignment_form_assignment_spec_location', with: 'testLocation'
check("assignment_form_assignment_microtask")
check("assignment_form_assignment_reviews_visible_to_all")
check("assignment_form_assignment_is_calibrated")
uncheck("assignment_form_assignment_availability_flag")
expect(page).to have_select("assignment_form[assignment][reputation_algorithm]", options: %w[-- Hamer Lauw])
select "--", from: 'countsofcomment'

click_button 'Create'
assignment = Assignment.where(name: 'public assignment for test').first
expect(assignment).to have_attributes(
name: 'public assignment for test',
course_id: Course.find_by(name: 'Course 2').id,
directory_path: 'testDirectory',
spec_location: 'testLocation',
microtask: true,
is_calibrated: true,
availability_flag: false,
heatgrid_metric: ''
)
end

it "is able to create with teams" do
assignment_creation_setup(1,'private assignment for test')
check("team_assignment")
Expand Down
12 changes: 12 additions & 0 deletions spec/models/assignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,18 @@
end
end

describe '#heatgrid_metric' do
it 'returns countofcomments by default' do
assignment = create(:assignment)
expect(assignment.heatgrid_metric).to eq('countofcomments')
end

it 'none value can be selected' do
assignment = build(:assignment, heatgrid_metric: '')
expect(assignment.heatgrid_metric).to eq('')
end
end

describe '#num_review_rounds' do
it 'returns max round number in all due dates of current assignment' do
allow(AssignmentDueDate).to receive(:where).with(parent_id: 1).and_return([assignment_due_date])
Expand Down