Skip to content

Commit

Permalink
Merge bdfc2fd into 7202fe9
Browse files Browse the repository at this point in the history
  • Loading branch information
namanshrimali committed Jul 9, 2022
2 parents 7202fe9 + bdfc2fd commit c015d88
Show file tree
Hide file tree
Showing 49 changed files with 104 additions and 104 deletions.
8 changes: 4 additions & 4 deletions app/controllers/grades_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def controller_locale
def view
@assignment = Assignment.find(params[:id])
questionnaires = @assignment.questionnaires
if @assignment.vary_by_round
if @assignment.vary_by_round?
@questions = retrieve_questions questionnaires, @assignment.id
else
@questions = {}
Expand Down Expand Up @@ -91,7 +91,7 @@ def view_team
counter_for_same_rubric = 0
questionnaires.each do |questionnaire|
@round = nil
if @assignment.vary_by_round && questionnaire.type == 'ReviewQuestionnaire'
if @assignment.vary_by_round? && questionnaire.type == 'ReviewQuestionnaire'
questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)
if questionnaires.count > 1
@round = questionnaires[counter_for_same_rubric].used_in_round
Expand Down Expand Up @@ -193,7 +193,7 @@ def populate_view_model(questionnaire)
vmquestions = questionnaire.questions
vm.add_questions(vmquestions)
vm.add_team_members(@team)
vm.add_reviews(@participant, @team, @assignment.vary_by_round)
vm.add_reviews(@participant, @team, @assignment.vary_by_round?)
vm.calculate_metrics
vm
end
Expand Down Expand Up @@ -232,7 +232,7 @@ def make_chart
participant_score_types = %i[metareview feedback teammate]
if @pscore[:review]
scores = []
if @assignment.vary_by_round
if @assignment.vary_by_round?
(1..@assignment.rounds_of_reviews).each do |round|
responses = @pscore[:review][:assessments].select { |response| response.round == round }
scores = scores.concat(score_vector(responses, 'review' + round.to_s))
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/popup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def team_users_popup
# However, we want their user_id. This is not possible for teams, so we just return the current id
reviewer_id = ResponseMap.find(params[:id2]).reviewer_id
# E2060 - we had to change this if/else clause in order to properly view reports page
@reviewer_id = if @assignment.reviewer_is_team
@reviewer_id = if @assignment.team_reviewing_enabled
reviewer_id
else
Participant.find(reviewer_id).user_id
Expand Down Expand Up @@ -89,7 +89,7 @@ def view_review_scores_popup
@reviews = []

assignment = Assignment.find(@assignment_id)
flash.now[:error] = 'This report is not implemented for assignments where the rubric varies by topic.' if assignment.vary_by_topic
flash.now[:error] = 'This report is not implemented for assignments where the rubric varies by topic.' if assignment.vary_by_topic?
end

# this can be called from "response_report" by clicking reviewer names from instructor end.
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/profile_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def update
end
if @user.update_attributes(user_params)
ExpertizaLogger.info LoggerMessage.new(controller_name, @user.name, 'Your profile was successfully updated.', request)
@user.preference_home_flag = params[:no_show_action] != 'not_show_actions'
@user.etc_icons_on_homepage = params[:no_show_action] != 'not_show_actions'
@user.save!
flash[:success] = 'Your profile was successfully updated.'
else
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/response_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def json
# E2218: Method to delete a response.
def delete
# The locking was added for E1973, team-based reviewing. See lock.rb for details
if @map.reviewer_is_team
if @map.team_reviewing_enabled
@response = Lock.get_lock(@response, current_user, Lock::DEFAULT_TIMEOUT)
if @response.nil?
response_lock_action
Expand Down Expand Up @@ -93,7 +93,7 @@ def edit
end
# Added for E1973, team-based reviewing
@map = @response.map
if @map.reviewer_is_team
if @map.team_reviewing_enabled
@response = Lock.get_lock(@response, current_user, Lock::DEFAULT_TIMEOUT)
if @response.nil?
response_lock_action
Expand All @@ -119,7 +119,7 @@ def update
begin
# the response to be updated
# Locking functionality added for E1973, team-based reviewing
if @map.reviewer_is_team && !Lock.lock_between?(@response, current_user)
if @map.team_reviewing_enabled && !Lock.lock_between?(@response, current_user)
response_lock_action
return
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/student_review_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def list
if @participant.get_reviewer
# ACS Removed the if condition(and corresponding else) which differentiate assignments as team and individual assignments
# to treat all assignments as team assignments
@review_mappings = ReviewResponseMap.where(reviewer_id: @participant.get_reviewer.id, reviewer_is_team: @assignment.reviewer_is_team)
@review_mappings = ReviewResponseMap.where(reviewer_id: @participant.get_reviewer.id, team_reviewing_enabled: @assignment.team_reviewing_enabled)
else
@review_mappings = []
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def foreign

private

# add user preference_home_flag
# add user etc_icons_on_homepage
def user_params
params.require(:user).permit(:name,
:crypted_password,
Expand All @@ -219,7 +219,7 @@ def user_params
:public_key,
:copy_of_emails,
:institution_id,
:preference_home_flag)
:etc_icons_on_homepage)
end

# to find the role of a given user object and set the @role accordingly
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/grades_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def view_heatgrid(participant_id, type)
# loop through each questionnaire, and populate the view model for all data necessary
# to render the html tables.
questionnaires.each do |questionnaire|
@round = if @assignment.vary_by_round && questionnaire.type == 'ReviewQuestionnaire'
@round = if @assignment.vary_by_round? && questionnaire.type == 'ReviewQuestionnaire'
AssignmentQuestionnaire.find_by(assignment_id: @assignment.id, questionnaire_id: questionnaire.id).used_in_round
end
next unless questionnaire.type == type
Expand All @@ -141,7 +141,7 @@ def view_heatgrid(participant_id, type)
questions = questionnaire.questions
vm.add_questions(questions)
vm.add_team_members(@team)
vm.add_reviews(@participant, @team, @assignment.vary_by_round)
vm.add_reviews(@participant, @team, @assignment.vary_by_round?)
vm.number_of_comments_greater_than_10_words
@vmlist << vm
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/report_formatter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def review_response_map(params, _session = nil)
def feedback_response_map(params, _session = nil)
assign_basics(params)
# If review report for feedback is required call feedback_response_report method in feedback_review_response_map model
if @assignment.vary_by_round
if @assignment.vary_by_round?
@authors, @all_review_response_ids_round_one, @all_review_response_ids_round_two, @all_review_response_ids_round_three =
FeedbackResponseMap.feedback_response_report(@id, @type)
else
Expand Down
2 changes: 1 addition & 1 deletion app/models/assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def self.export(csv, parent_id, options)
@questions = {}
questionnaires = @assignment.questionnaires
questionnaires.each do |questionnaire|
if @assignment.vary_by_round
if @assignment.vary_by_round?
round = AssignmentQuestionnaire.find_by(assignment_id: @assignment.id, questionnaire_id: @questionnaire.id).used_in_round
questionnaire_symbol = round.nil? ? questionnaire.symbol : (questionnaire.symbol.to_s + round.to_s).to_sym
else
Expand Down
8 changes: 4 additions & 4 deletions app/models/assignment_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def update(attributes, user, _vary_by_topic_desired = false)
end
update_assignment(attributes[:assignment])
update_assignment_questionnaires(attributes[:assignment_questionnaire]) unless @has_errors
update_assignment_questionnaires(attributes[:topic_questionnaire]) unless @has_errors || attributes[:assignment][:vary_by_topic] == 'false'
update_assignment_questionnaires(attributes[:topic_questionnaire]) unless @has_errors || attributes[:assignment][:vary_by_topic?] == 'false'
update_due_dates(attributes[:due_date], user) unless @has_errors
update_assigned_badges(attributes[:badge], attributes[:assignment]) unless @has_errors
add_simicheck_to_delayed_queue(attributes[:assignment][:simicheck])
Expand Down Expand Up @@ -240,21 +240,21 @@ def assignment_questionnaire(questionnaire_type, round_number, topic_id, duty_id
# If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it
return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type
end
elsif @assignment.vary_by_round && @assignment.vary_by_topic
elsif @assignment.vary_by_round? && @assignment.vary_by_topic?
# Get all AQs for the assignment and specified round number and topic
assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, used_in_round: round_number, topic_id: topic_id)
assignment_questionnaires.each do |aq|
# If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it
return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type
end
elsif @assignment.vary_by_round
elsif @assignment.vary_by_round?
# Get all AQs for the assignment and specified round number by round #
assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, used_in_round: round_number)
assignment_questionnaires.each do |aq|
# If the AQ questionnaire matches the type of the questionnaire that needs to be updated, return it
return aq if aq.questionnaire_id && Questionnaire.find(aq.questionnaire_id).type == questionnaire_type
end
elsif @assignment.vary_by_topic
elsif @assignment.vary_by_topic?
# Get all AQs for the assignment and specified round number by topic
assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, topic_id: topic_id)
assignment_questionnaires.each do |aq|
Expand Down
4 changes: 2 additions & 2 deletions app/models/assignment_participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def reviews
ReviewResponseMap.assessments_for(team)
end

# returns the reviewer of the assignment. Checks the reviewer_is_team flag to
# returns the reviewer of the assignment. Checks the team_reviewing_enabled flag to
# determine whether this AssignmentParticipant or their team is the reviewer
def get_reviewer
return team if assignment.reviewer_is_team
return team if assignment.team_reviewing_enabled

self
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/assignment_team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def assign_reviewer(reviewer)
assignment = Assignment.find(parent_id)
raise 'The assignment cannot be found.' if assignment.nil?

ReviewResponseMap.create(reviewee_id: id, reviewer_id: reviewer.get_reviewer.id, reviewed_object_id: assignment.id, reviewer_is_team: assignment.reviewer_is_team)
ReviewResponseMap.create(reviewee_id: id, reviewer_id: reviewer.get_reviewer.id, reviewed_object_id: assignment.id, team_reviewing_enabled: assignment.team_reviewing_enabled)
end

# E-1973 If a team is being treated as a reviewer of an assignment, then they are the reviewer
Expand Down
4 changes: 2 additions & 2 deletions app/models/feedback_response_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.feedback_response_report(id, _type)
@temp_review_responses = Response.where(['map_id IN (?)', @review_response_map_ids]).order('created_at DESC')
# we need to pick the latest version of review for each round
@temp_response_map_ids = []
if Assignment.find(id).vary_by_round
if Assignment.find(id).vary_by_round?
@all_review_response_ids_round_one = []
@all_review_response_ids_round_two = []
@all_review_response_ids_round_three = []
Expand All @@ -68,7 +68,7 @@ def self.feedback_response_report(id, _type)
end
# @feedback_response_map_ids = ResponseMap.where(["reviewed_object_id IN (?) and type = ?", @all_review_response_ids, type]).pluck("id")
# @feedback_responses = Response.where(["map_id IN (?)", @feedback_response_map_ids]).pluck("id")
if Assignment.find(id).vary_by_round
if Assignment.find(id).vary_by_round?
return @authors, @all_review_response_ids_round_one, @all_review_response_ids_round_two, @all_review_response_ids_round_three
else
return @authors, @all_review_response_ids
Expand Down
8 changes: 4 additions & 4 deletions app/models/review_response_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ReviewResponseMap < ResponseMap
# ReviewResponseMap was created in so many places, I thought it best to add this here as a catch-all
def after_initialize
# If an assignment supports team reviews, it is marked in each mapping
assignment.reviewer_is_team
assignment.team_reviewing_enabled
end

# Find a review questionnaire associated with this review response map's assignment
Expand Down Expand Up @@ -116,7 +116,7 @@ def get_reviewer
# the assignment is used to determine if the reviewer is a participant or a team
def self.get_reviewer_with_id(assignment_id, reviewer_id)
assignment = Assignment.find(assignment_id)
if assignment.reviewer_is_team
if assignment.team_reviewing_enabled
return AssignmentTeam.find(reviewer_id)
else
return AssignmentParticipant.find(reviewer_id)
Expand All @@ -142,7 +142,7 @@ def self.review_response_report(id, assignment, type, review_user)
@reviewers << ReviewResponseMap.get_reviewer_with_id(assignment.id, reviewer_id_from_response_map.reviewer_id)
end
# we sort the reviewer by name here, using whichever class it is an instance of
@reviewers = if assignment.reviewer_is_team
@reviewers = if assignment.team_reviewing_enabled
Team.sort_by_name(@reviewers)
else
Participant.sort_by_name(@reviewers)
Expand All @@ -151,7 +151,7 @@ def self.review_response_report(id, assignment, type, review_user)
# This is a search, so find reviewers by user's full name
user_ids = User.select('DISTINCT id').where('fullname LIKE ?', '%' + review_user[:fullname] + '%')
# E1973 - we use a separate query depending on if the reviewer is a team or participant
if assignment.reviewer_is_team
if assignment.team_reviewing_enabled
reviewer_participants = AssignmentTeam.where('id IN (?) and parent_id = ?', team_ids, assignment.id)
@reviewers = []
reviewer_participants.each do |participant|
Expand Down
2 changes: 1 addition & 1 deletion app/models/tag_prompt_deployment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def assignment_tagging_progress
user_answer_tagging = []
unless teams.empty? || questions.empty?
teams.each do |team|
if assignment.vary_by_round
if assignment.vary_by_round?
responses = []
1.upto(assignment.rounds_of_reviews).each do |round|
responses += ReviewResponseMap.get_responses_for_team_round(team, round)
Expand Down
6 changes: 3 additions & 3 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def initialize(attributes = nil)
@email_on_submission = true
@email_on_review_of_review = true
@copy_of_emails = false
@preference_home_flag = true
@etc_icons_on_homepage = true
end

def self.export(csv, _parent_id, options)
Expand All @@ -261,7 +261,7 @@ def self.export(csv, _parent_id, options)
tcsv.push(user.role.name) if options['role'] == 'true'
tcsv.push(user.parent.name) if options['parent'] == 'true'
tcsv.push(user.email_on_submission, user.email_on_review, user.email_on_review_of_review, user.copy_of_emails) if options['email_options'] == 'true'
tcsv.push(user.preference_home_flag) if options['preference_home_flag'] == 'true'
tcsv.push(user.etc_icons_on_homepage) if options['etc_icons_on_homepage'] == 'true'
tcsv.push(user.handle) if options['handle'] == 'true'
csv << tcsv
end
Expand All @@ -277,7 +277,7 @@ def self.export_fields(options)
fields.push('role') if options['role'] == 'true'
fields.push('parent') if options['parent'] == 'true'
fields.push('email on submission', 'email on review', 'email on metareview', 'copy of emails') if options['email_options'] == 'true'
fields.push('preference home flag') if options['preference_home_flag'] == 'true'
fields.push('preference home flag') if options['etc_icons_on_homepage'] == 'true'
fields.push('handle') if options['handle'] == 'true'
fields
end
Expand Down
8 changes: 4 additions & 4 deletions app/views/assignments/edit/_review_strategy.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@
</tr>

<tr>
<td id='reviewer_is_team'>
<input name="assignment_form[assignment][reviewer_is_team]" type="hidden" value="false"/>
<%= check_box_tag('assignment_form[assignment][reviewer_is_team]', 'true', @assignment_form.assignment.reviewer_is_team) %>
<%= label_tag('assignment_form[assignment][reviewer_is_team]', 'Is Review done by Teams?') %>
<td id='team_reviewing_enabled'>
<input name="assignment_form[assignment][team_reviewing_enabled]" type="hidden" value="false"/>
<%= check_box_tag('assignment_form[assignment][team_reviewing_enabled]', 'true', @assignment_form.assignment.team_reviewing_enabled) %>
<%= label_tag('assignment_form[assignment][team_reviewing_enabled]', 'Is Review done by Teams?') %>
<img src="/assets/info.png" title='You can select whether the reviews should be done by individual students or teams'>
</td>
</tr>
Expand Down
18 changes: 9 additions & 9 deletions app/views/assignments/edit/_rubrics.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,16 @@
</script>

<!--Add a review varies by round checkbox. -->
<!-- This is vary_by_round attribute of assignment created by migration -->
<input name="assignment_form[assignment][vary_by_round]" type="hidden" value="false" />
<%= check_box_tag('assignment_form[assignment][vary_by_round]', 'true', @assignment_form.assignment.vary_by_round, onclick: "handleCheckReviewVaryByRound(this)") %>
<%= label_tag('assignment_form[assignment][vary_by_round]', 'Review rubric varies by round?') %>
<!-- This is vary_by_round? attribute of assignment created by migration -->
<input name="assignment_form[assignment][vary_by_round?]" type="hidden" value="false" />
<%= check_box_tag('assignment_form[assignment][vary_by_round?]', 'true', @assignment_form.assignment.vary_by_round?, onclick: "handleCheckReviewVaryByRound(this)") %>
<%= label_tag('assignment_form[assignment][vary_by_round?]', 'Review rubric varies by round?') %>
<br>
<!-- Add a review varies by topic checkbox -->
<!-- This is vary_by_topic attribute of assignment created by migration -->
<input name="assignment_form[assignment][vary_by_topic]" type="hidden" value="false" />
<%= check_box_tag('assignment_form[assignment][vary_by_topic]', 'true', @assignment_form.assignment.vary_by_topic) %>
<%= label_tag('assignment_form[assignment][vary_by_topic]', 'Review rubric varies by topic?') %>
<!-- This is vary_by_topic? attribute of assignment created by migration -->
<input name="assignment_form[assignment][vary_by_topic?]" type="hidden" value="false" />
<%= check_box_tag('assignment_form[assignment][vary_by_topic?]', 'true', @assignment_form.assignment.vary_by_topic?) %>
<%= label_tag('assignment_form[assignment][vary_by_topic?]', 'Review rubric varies by topic?') %>
<br>
<!--Add a review varies by duties (role in the UI) checkbox if teams is allowed -->
<!-- This is questionnaire_varies_by_duty attribute of assignment created by migration -->
Expand Down Expand Up @@ -433,7 +433,7 @@
insertTeamBasedElements()
});

<% if @assignment_form.assignment.vary_by_round %>
<% if @assignment_form.assignment.vary_by_round? %>
<% 1.upto(@assignment_form.assignment.rounds_of_reviews) do |i| %>
<% assignment_questionnaire = @assignment_form.assignment_questionnaire('ReviewQuestionnaire', i, nil) %>
<% questionnaire = @assignment_form.questionnaire(assignment_questionnaire, 'ReviewQuestionnaire') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/export_file/_users.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<label for="Export Fields">Parent</label><br/>
<%= check_box 'options', 'email_options', {:checked => 'checked'}, "true", "false" %>
<label for="Export Fields">Email Options</label><br/>
<%= check_box 'options', 'preference_home_flag', {:checked => 'checked'}, "true", "false" %>
<%= check_box 'options', 'etc_icons_on_homepage', {:checked => 'checked'}, "true", "false" %>
<label for="Export Fields">Preference Home Flag</label><br/>
<%= check_box 'options', 'handle', {:checked => 'checked'}, "true", "false" %>
<label for="Export Fields">Handle</label><br/>
Expand Down
Loading

0 comments on commit c015d88

Please sign in to comment.