lib/papercall/analysis.rb in papercall-0.15.0 vs lib/papercall/analysis.rb in papercall-0.15.1
- old
+ new
@@ -16,48 +16,50 @@
@analysis['rejected'] = []
@analysis['confirmed'] = []
end
def analyze
- startTime = Time.now
+ start_time = Time.now
print 'Performing analysis...'
@analysis['submissions'].each do |submission|
submission['ratings'].each do |rating|
if !(@analysis['reviewers'].include? rating['user']['name'])
- @analysis['reviewers'][rating['user']['name']] = [{:id => rating['submission_id']}]
+ @analysis['reviewers'][rating['user']['name']] = [{ id: rating['submission_id'] }]
else
- @analysis['reviewers'][rating['user']['name']] << {:id => rating['submission_id']}
+ @analysis['reviewers'][rating['user']['name']] << { id: rating['submission_id'] }
end
end
- @analysis['talksWithoutReviews'] << {:id => submission['id'], :submission => submission} if submission['ratings'].empty?
- @analysis['talksWithFourOrMoreReviews'] << {:id => submission['id'], :submission => submission} if submission['ratings'].size >= 4
- @analysis['talksWithLessThanThreeReviews'] << {:id => submission['id'], :submission => submission} if submission['ratings'].size < 3
- @analysis['talksWithoutFeedback'] << {:id => submission['id'], :submission => submission} if submission['feedback'].empty?
- @analysis['highlyRated'] << {:id => submission['id'], :submission => submission} if highlyRated? submission
- @analysis['lowRated'] << {:id => submission['id'], :submission => submission} if lowRated? submission
- @analysis['maybe'] << {:id => submission['id'], :submission => submission} if maybe? submission
- @analysis['accepted'] << {:id => submission['id'], :submission => submission} if accepted? submission
- @analysis['waitlist'] << {:id => submission['id'], :submission => submission} if waitlisted? submission
- @analysis['rejected'] << {:id => submission['id'], :submission => submission} if rejected? submission
- @analysis['confirmed'] << {:id => submission['id'], :submission => submission} if confirmed? submission
+ @analysis['talksWithoutReviews'] << { id: submission['id'], submission: submission } if submission['ratings'].empty?
+ @analysis['talksWithFourOrMoreReviews'] << { id: submission['id'], submission: submission } if submission['ratings'].size >= 4
+ @analysis['talksWithLessThanThreeReviews'] << { id: submission['id'], submission: submission } if submission['ratings'].size < 3
+ @analysis['talksWithoutFeedback'] << { id: submission['id'], submission: submission } if submission['feedback'].empty?
+ @analysis['highlyRated'] << { id: submission['id'], submission: submission } if highly_rated? submission
+ @analysis['lowRated'] << { id: submission['id'], submission: submission } if low_rated? submission
+ @analysis['maybe'] << { id: submission['id'], submission: submission } if maybe? submission
+ @analysis['accepted'] << { id: submission['id'], submission: submission } if accepted? submission
+ @analysis['waitlist'] << { id: submission['id'], submission: submission } if waitlisted? submission
+ @analysis['rejected'] << { id: submission['id'], submission: submission } if rejected? submission
+ @analysis['confirmed'] << { id: submission['id'], submission: submission } if confirmed? submission
end
@analysis['summary'] = summary
- puts "finished in #{Time.now - startTime} seconds."
+ puts "finished in #{Time.now - start_time} seconds."
@analysis
end
private
- def highlyRated?(submission)
+ def highly_rated?(submission)
submission['rating'] >= 75 && review_complete?(submission)
end
- def lowRated?(submission)
+ def low_rated?(submission)
submission['rating'] <= 25 && review_complete?(submission)
end
def maybe?(submission)
- !accepted?(submission) && !rejected?(submission) && review_complete?(submission)
+ !accepted?(submission) &&
+ !rejected?(submission) &&
+ review_complete?(submission)
end
def review_complete?(submission)
submission['ratings'].size >= 3
end