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

E1642 Refactor review_response_map.rb #797

Merged
merged 29 commits into from Nov 16, 2016
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
75bf438
metareview_response_maps refactored
VivekBhat Oct 25, 2016
7a2e687
metareview_response_maps
VivekBhat Oct 25, 2016
9f848d5
metareview_response_maps refactored
VivekBhat Oct 25, 2016
a4124da
Used find_by instead of where.first
VivekBhat Oct 25, 2016
99d8e36
changes related to Assignment Branch Condition size for final_version…
abhinand-lingareddy Oct 26, 2016
4e270e0
changing access modifier of prepare_review_response and prepare_final…
abhinand-lingareddy Oct 26, 2016
4575151
metareview_response_map double iteration removed
VivekBhat Oct 26, 2016
1f43c5e
refactoring done
VivekBhat Oct 26, 2016
f94fa83
changes as part replacing for with each
abhinand-lingareddy Oct 27, 2016
eb88cc8
changes as part of adding rpsec test for reviewresponsemap
abhinand-lingareddy Oct 27, 2016
953fa19
Merge pull request #1 from VivekBhat/vbhat
SmokingSadhus Oct 27, 2016
420a640
Merge pull request #2 from SmokingSadhus/abhinand
SmokingSadhus Oct 27, 2016
43a765a
Refactoring Get_assessments_round_for and removal of import method
SmokingSadhus Oct 27, 2016
d7a4ea6
Merge branch 'master' of https://github.com/SmokingSadhus/expertiza
SmokingSadhus Oct 27, 2016
61456d4
issue fix on metareview method
SmokingSadhus Oct 27, 2016
07d97a2
changes as part of adding test for final_versions_from_reviewer
abhinand-lingareddy Oct 28, 2016
5db4672
added test should return the valid questionnaire
abhinand-lingareddy Oct 28, 2016
7fe6503
refactored title method name
abhinand-lingareddy Oct 28, 2016
78176bc
changes as part of adding test for export_fields
abhinand-lingareddy Oct 28, 2016
56db467
Merge pull request #3 from SmokingSadhus/abhinand
SmokingSadhus Oct 28, 2016
c4c2109
Create new factory for reponse and response_map
SmokingSadhus Oct 28, 2016
d65400b
Merge branch 'master' of https://github.com/SmokingSadhus/expertiza
SmokingSadhus Oct 28, 2016
b5f6fcc
Add new test cases for refactored method get_responses_for_team_round
SmokingSadhus Oct 28, 2016
dc0735b
Added unit tests for rereview_response_maps
SmokingSadhus Oct 28, 2016
cbb69eb
Revert and Codefix
SmokingSadhus Oct 28, 2016
aab2166
added few rspec tests for getfinalreviewresponse
abhinand-lingareddy Oct 29, 2016
e41b6a6
Fixing metareview_response refactor and get_title refactor
SmokingSadhus Oct 29, 2016
40a68bf
Merge branch 'master' of https://github.com/SmokingSadhus/expertiza
SmokingSadhus Oct 29, 2016
f1be3e0
remove unnecessary variables
SmokingSadhus Oct 29, 2016
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+13 −7
Diff settings

Always

Just for now

metareview_response_map double iteration removed

  • Loading branch information...
VivekBhat committed Oct 26, 2016
commit 4575151cf59bb0f9df2dc1d888b3f24f4bcefc7f
Copy path View file
@@ -100,9 +100,9 @@ def response_map_to_metareview(metareviewer)
raise 'You have already metareviewed all reviews for this assignment.' if response_map_set.empty?

# Reduce to the response maps with the least number of metareviews received
response_map_set.sort! {|a, b| a.rereview_response_maps.count <=> b.rereview_response_maps.count }
min_metareviews = response_map_set.first.rereview_response_maps.count
response_map_set.reject! {|response_map| response_map.rereview_response_maps.count > min_metareviews }
response_map_set.sort! {|a, b| a.metareview_response_maps.count <=> b.metareview_response_maps.count }
min_metareviews = response_map_set.first.metareview_response_maps.count
response_map_set.reject! {|response_map| response_map.metareview_response_maps.count > min_metareviews }

# Reduce the response maps to the reviewers with the least number of metareviews received
reviewers = {} # <reviewer, number of metareviews>
@@ -116,9 +116,9 @@ def response_map_to_metareview(metareviewer)
response_map_set.reject! {|response_map| reviewers.member?(response_map.reviewer) }

# Pick the response map whose most recent meta_reviewer was assigned longest ago
response_map_set.sort! {|a, b| a.rereview_response_maps.count <=> b.rereview_response_maps.count }
min_metareviews = response_map_set.first.rereview_response_maps.count
response_map_set.sort! {|a, b| a.rereview_response_maps.last.id <=> b.rereview_response_maps.last.id } if min_metareviews > 0
response_map_set.sort! {|a, b| a.metareview_response_maps.count <=> b.metareview_response_maps.count }
min_metareviews = response_map_set.first.metareview_response_maps.count
response_map_set.sort! {|a, b| a.metareview_response_maps.last.id <=> b.metareview_response_maps.last.id } if min_metareviews > 0
# The first review_map is the best candidate to metareview
response_map_set.first
end
@@ -109,8 +109,14 @@ def self.add_reviewer(contributor_id, reviewer_id, assignment_id)
end
end

def rereview_response_maps
def metareview_response_maps
responses = Response.where(map_id: self.id)
metareview_list = []
responses.each do |response|
metareview_response_maps = MetareviewResponseMap.find_by reviewed_object_id: response.id
metareview_list << metareview_response_map
end
metareview_list
end

# return the responses for specified round, for varying rubric feature -Yang
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.