papercallio 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dada3e353c637f0294d130dce78bc9e2dd9bfa22
4
- data.tar.gz: 36c8ec5198631fb7b592f8e70e51a29482fe440a
3
+ metadata.gz: 7aedc48b66ae9c2dca7fe27b3ace0f7a24297a81
4
+ data.tar.gz: bcf865c5b1a615af407c7aa3c88446b17c137474
5
5
  SHA512:
6
- metadata.gz: dabb04071412030a1d29ecd89e4593ee49bf9c67a5ae20e0f52d3f0ac3dca3772ee5f6a95e471f0474f7b96ef82dbc12a5b72f89b1924f39f7c7ff6f7bdc51e4
7
- data.tar.gz: 6985fa53645c252b833cbb54ad819f269fba07d8a4856d2155b3cc9ea3be508eb1e9ed915781529794660f0fc67f062be6f5ef5e951d754b78937c8292119f2e
6
+ metadata.gz: b422e7f7f1ed472750a40a39bc67b738efdc51cd493a26f59ffba8ab0a6b7aa91263916da1c94012f5dbf302afb6d8cad7ef587ecb2d1a2969af466d3fc2b0a5
7
+ data.tar.gz: d1e6e9519bf0c1183fd9261a9ead8868070ea74bc3318aae47190038dd21ab1f75980597af2f4c2ae50abc4a82320d66038dbb3f011028a954d26c6db4297811
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- papercallio (0.2.3)
4
+ papercallio (0.3.0)
5
+ descriptive_statistics (~> 2.5)
5
6
  gli (= 2.16.0)
6
7
  httparty (~> 0.15)
7
8
 
@@ -30,6 +31,7 @@ GEM
30
31
  cucumber-core (1.5.0)
31
32
  gherkin (~> 4.0)
32
33
  cucumber-wire (0.0.1)
34
+ descriptive_statistics (2.5.1)
33
35
  diff-lcs (1.3)
34
36
  ffi (1.9.18)
35
37
  gherkin (4.1.3)
@@ -3,9 +3,17 @@ require 'gli'
3
3
  require 'papercallio'
4
4
  require 'csv'
5
5
  require 'yaml'
6
+ require 'descriptive_statistics'
6
7
 
7
8
  include GLI::App
8
9
 
10
+ class Float
11
+ def signif(digits)
12
+ return 0 if self.zero?
13
+ self.round(-(Math.log10(self).ceil - digits))
14
+ end
15
+ end
16
+
9
17
  program_desc %(Command line interface for the papercall.io API
10
18
  papercallio requires API access to download data.
11
19
  API access is a paid feature, papercallio will not work with the free papercall plan.
@@ -56,22 +64,13 @@ command :submissions do |c|
56
64
  submissions = []
57
65
  headers = []
58
66
  headerset = false
59
- n = 0
60
- puts response
67
+ reviewers = {}
61
68
  response.each do |submission|
62
- n = n = 1
63
- puts n
64
- puts "#{submission}\n\n"
65
69
  line = {}
66
70
  id = nil
67
- m = 0
68
71
  submission.each do |field, value|
69
- m = m+1
70
- puts "#{m} #{field}: #{value}\n\n"
71
72
  if value.is_a?(Hash)
72
- puts "#{value}\n\n"
73
73
  value.each do |subfield, subvalue|
74
- puts "#{subfield}: #{subvalue}\n\n"
75
74
  line["#{field}_#{subfield}"] = subvalue
76
75
  headers << "#{field}_#{subfield}" unless headerset
77
76
  end
@@ -82,36 +81,44 @@ command :submissions do |c|
82
81
  headers << field unless headerset
83
82
  end
84
83
 
85
-
86
-
87
84
  if options[:include_feedback]
88
85
  #puts "OK!"
89
86
  #submission_feedback = pcc.feedback(id)
90
87
  #puts submission_feedback
91
88
  end
92
89
  if options[:include_ratings]
93
-
94
90
  submission_ratings = pcc.rating(id)
95
91
  total_ratings = 0
96
92
  individual_ratings = ''
97
93
  raters = ''
98
94
  comments = ''
99
- puts "made it here!!"
100
- puts submission_ratings
95
+ headers.concat([:total_ratings, :individual_ratings, :raters, :comments]) unless headerset
101
96
  submission_ratings.each do |rate|
102
- puts "#{rate}"
97
+ user = ''
98
+ rating = 0
99
+ comment = ''
103
100
  rate.each do |rate_field, rate_value|
101
+ # individual
102
+ user = rate_value['name'].to_s if rate_field == 'user'
103
+ rating = rate_value if rate_field == 'value'
104
+ comment = rate_value if rate_field == 'comments'
105
+ # cumulative
104
106
  total_ratings += rate_value if rate_field == 'value'
105
107
  individual_ratings << "#{rate_value}, " if rate_field == 'value'
106
108
  raters << "#{rate_value['name']}, " if rate_field == 'user'
107
- comments << "#{rate_value['comments']}, " if rate_field == 'comments'
109
+ comments << "#{rate_value}, " if rate_field == 'comments'
108
110
  end
111
+ reviewers[user] = [] unless headers.include?("#{user}-rating")
112
+ reviewers[user].push(rating)
113
+ headers.push("#{user}-rating") unless headers.include?("#{user}-rating")
114
+ headers.push("#{user}-comment") unless headers.include?("#{user}-comment")
115
+ line["#{user}-rating"] = rating
116
+ line["#{user}-comment"] = comment
109
117
  end
110
118
  line[:total_ratings] = total_ratings
111
119
  line[:individual_ratings] = individual_ratings
112
120
  line[:raters] = raters
113
121
  line[:comments] = comments
114
- headers.concat([:total_ratings, :individual_ratings, :raters, :comments]) unless headerset
115
122
  end
116
123
  headerset = true
117
124
  submissions << line
@@ -123,7 +130,13 @@ command :submissions do |c|
123
130
  f.puts headers.map { |h| sub[h] }.to_csv
124
131
  end
125
132
  end
126
-
133
+ if options[:include_ratings]
134
+ puts 'Summary of reviewers:'
135
+ puts "Name: \t\t ratings \t mean \t median \t mode \t stdev \t range \t high \t low"
136
+ reviewers.each do |name, rating_array|
137
+ puts "#{name}: \t #{rating_array.size} \t\t #{rating_array.mean.signif(4)} \t #{rating_array.median} \t\t #{rating_array.mode} \t #{rating_array.standard_deviation.signif(4)} \t #{rating_array.range} \t #{rating_array.percentile(100)} \t #{rating_array.percentile(0)}"
138
+ end
139
+ end
127
140
  puts "submissions have been output to #{global_options[:file]}"
128
141
  end
129
142
  end
@@ -1,3 +1,3 @@
1
1
  module Papercallio
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -20,4 +20,5 @@ spec = Gem::Specification.new do |s|
20
20
  s.add_development_dependency 'rspec', '~> 3.6'
21
21
  s.add_runtime_dependency 'gli', '2.16.0'
22
22
  s.add_runtime_dependency 'httparty', '~> 0.15'
23
+ s.add_runtime_dependency 'descriptive_statistics', '~> 2.5'
23
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papercallio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aaronblythe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-01 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.15'
97
+ - !ruby/object:Gem::Dependency
98
+ name: descriptive_statistics
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.5'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.5'
97
111
  description:
98
112
  email: aaron.blythe@gmail.com
99
113
  executables: