Module: Papercall

Defined in:
lib/papercall/core.rb,
lib/papercall/fetcher.rb,
lib/papercall/version.rb,
lib/papercall/analysis.rb,
lib/papercall/file_fetcher.rb,
lib/papercall/rest_fetcher.rb,
lib/papercall/configuration.rb

Overview

Module for fetching submissions from the PaperCall.io paper submission system Also providing some analytics

Defined Under Namespace

Classes: Analysis, Configuration, Fetcher, FileFetcher, RestFetcher

Constant Summary collapse

METHOD_REGEX =
/(.*)_talks$/
VERSION =
'1.0.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



9
10
11
# File 'lib/papercall/core.rb', line 9

def self.configuration
  @configuration ||= Configuration.new
end

Class Method Details

.active_reviewersObject



47
48
49
# File 'lib/papercall/core.rb', line 47

def self.active_reviewers
  @analysis.reviewers
end

.allObject



28
29
30
# File 'lib/papercall/core.rb', line 28

def self.all
  @submissions.analysis
end

.analysisObject



59
60
61
# File 'lib/papercall/core.rb', line 59

def self.analysis
  @analysis
end

.configure {|configuration| ... } ⇒ Object

Yields:



13
14
15
# File 'lib/papercall/core.rb', line 13

def self.configure
  yield(configuration)
end

.confirmed_talksObject



41
42
43
44
45
# File 'lib/papercall/core.rb', line 41

def self.confirmed_talks
  @submissions.accepted.select do |s|
    s.confirmed?
  end
end

.fetch(from, *states) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/papercall/core.rb', line 17

def self.fetch(from, *states)
  if from == :from_file
    @submissions = Papercall::FileFetcher.new
  elsif from == :from_papercall
    @submissions = Papercall::RestFetcher.new
  end
  @submissions.fetch(states)
  #puts @submissions.analysis
  @analysis = Papercall::Analysis.new(@submissions.analysis)
end

.method_missing(method_name, *args, &block) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/papercall/core.rb', line 88

def self.method_missing(method_name, *args, &block)
  if METHOD_REGEX.match method_name.to_s
    @submissions.send(Regexp.last_match[1])
  else
    super
  end
end

.number_of_submissionsObject



37
38
39
# File 'lib/papercall/core.rb', line 37

def self.number_of_submissions
  all.length
end

.respond_to_missing?(method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/papercall/core.rb', line 84

def self.respond_to_missing?(method_name, _include_private = false)
  METHOD_REGEX.match method_name.to_s
end

.save_to_file(filename) ⇒ Object



32
33
34
35
# File 'lib/papercall/core.rb', line 32

def self.save_to_file(filename)
  ff = File.open(filename, 'w') { |f| f.write(@submissions.all.to_json) }
  puts "All submissions written to file #{filename}." if ff && configuration.output
end

.submissions_with_enough_reviewsObject



55
56
57
# File 'lib/papercall/core.rb', line 55

def self.submissions_with_enough_reviews
  @analysis.submissions - @analysis.talks_missing_reviews
end

.submissions_without_feedbackObject



51
52
53
# File 'lib/papercall/core.rb', line 51

def self.submissions_without_feedback
  @analysis.talks_without_feedback
end

.summaryObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/papercall/core.rb', line 63

def self.summary
  a = @analysis
  if configuration.output
    puts "Number of submissions: #{a.number_of_submissions}"
    puts "Number of active reviewers: #{a.number_of_active_reviewers}"
    puts "Number of submitted talks without feedback: #{a.number_without_feedback}"
    puts "Number of talks with three or more reviews: #{a.number_completed}"
    puts "Number of highly rated talks: #{a.number_of_highly_rated}"
    puts "Number of low rated talks: #{a.number_of_low_rated}"
    puts "Number of middle rated talks: #{a.number_of_maybes}"
    puts "Number of talks with less than three reviews: #{a.number_with_few_reviews}"
    puts "Number of talks with four or more reviews: #{a.number_with_many_reviews}"
    puts "Number of talks without reviews: #{a.number_without_reviews}"
    puts "Number of accepted talks: #{a.number_accepted}"
    puts "Number of waitlisted talks: #{a.number_of_waitlisted}"
    puts "Number of rejected talks: #{a.number_rejected}"
    puts "Number of confirmed talks: #{a.number_confirmed}"
  end
  a
end