lib/papercall/analysis.rb in papercall-0.14.0 vs lib/papercall/analysis.rb in papercall-0.15.0
- old
+ new
@@ -17,67 +17,67 @@
@analysis['confirmed'] = []
end
def analyze
startTime = Time.now
- print "Performing analysis..."
+ print 'Performing analysis...'
@analysis['submissions'].each do |submission|
- submission["ratings"].each do |rating|
- unless(@analysis['reviewers'].include?(rating["user"]["name"]))
- @analysis['reviewers'][rating["user"]["name"]] = [{:id => rating["submission_id"]}]
+ submission['ratings'].each do |rating|
+ if !(@analysis['reviewers'].include? rating['user']['name'])
+ @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 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
end
@analysis['summary'] = summary
puts "finished in #{Time.now - startTime} seconds."
@analysis
end
private
def highlyRated?(submission)
- submission["rating"] >= 75 && review_complete?(submission)
+ submission['rating'] >= 75 && review_complete?(submission)
end
def lowRated?(submission)
- submission["rating"] <= 25 && review_complete?(submission)
+ submission['rating'] <= 25 && review_complete?(submission)
end
def maybe?(submission)
!accepted?(submission) && !rejected?(submission) && review_complete?(submission)
end
def review_complete?(submission)
- submission["ratings"].size >= 3
+ submission['ratings'].size >= 3
end
def accepted?(submission)
- submission["state"] == "accepted"
+ submission['state'] == 'accepted'
end
def rejected?(submission)
- submission["state"] == "rejected"
+ submission['state'] == 'rejected'
end
def waitlisted?(submission)
- submission["state"] == "waitlist"
+ submission['state'] == 'waitlist'
end
def confirmed?(submission)
- accepted?(submission) && submission["confirmed"] == true
+ accepted?(submission) && submission['confirmed'] == true
end
def summary
summary = {}
summary['numSubmissions'] = @analysis['submissions'].size