omegaup 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d68043d4f4131c6b4d11b1607e6d38b0ba05e74621bab4c08cf1bcc0e1c7a948
4
- data.tar.gz: cefb8c9d26da0a24d6d720fcd22fbcdc8a4aedc57f5a8b28d1e2b7ceedad9226
3
+ metadata.gz: a20539af83cd7b5c51fa0bfddcb7f67e8ef459208c1816f11c41e9dd3521b84f
4
+ data.tar.gz: 9b1328302a70ab1f7458b75682179b3a30893aa8fdffe39a979653cb9f88240a
5
5
  SHA512:
6
- metadata.gz: 84ee8b49d4c2d380b03b9dbbe6c67ae0af343a89b09b7fe5c95ac639a8be46478d484bb9c2e4328eff7e2705303ffaf807c7636418825b7995d5e0ef3fe50509
7
- data.tar.gz: 93c3a835cbbca8134b4ef626eb14c53061fc495c5cd7fc716a5333b8e209035e2beea10c840f0385f16a41d2632159a3b5367a7e36c4adb564f2433dfa26e99e
6
+ metadata.gz: c7ebb8af607d41acca6d2b880c45ee30eeba9f8fbe388eed8dc3b850b1fbf785fc6ad43ccb16acb69e8bf0048f5b70c9dd57d9f22ea41241c4e16317f8d0e2e8
7
+ data.tar.gz: a861ae1430e372049588bb1d0e7a81fbaa1043840f0947066767dd4957a2146d051009d2e44839a956169658f6c3dba985874e40224bdbc2cebf55543e5957b2
data/lib/omega/cli.rb CHANGED
@@ -23,14 +23,16 @@ module Omega
23
23
  OmegaUp CLI. Developed by OMIJal https://github.com/omijal/omegaup-cli.
24
24
  Tool for interacting with omegaup from CLI and available throug ruby gems.
25
25
  Commands:
26
- - register_users Add a user or a bunch of users to the a contest.
26
+ - register-users Add a user or a bunch of users to the a contest.
27
27
  - user Generates a dump of the user data in yml format.
28
28
  - scoreboard Gets contest scoreboard with users and score.
29
+ - clarifications Gets contest clarifications.
29
30
  Parametes:
30
31
  --contest Contest name
31
32
  --user Username or email
32
- --user_file A file path containing a list of user one per line without
33
+ --user-file A file path containing a list of user one per line without
33
34
  header
35
+ --open Filter to only open clarifications
34
36
  Setup:
35
37
  You need to add two env variables with your omegaup credentials.
36
38
  OMEGAUP_URL *Optional* This is intended for development purpose, it will target
@@ -58,6 +60,11 @@ OMEGAUP_PASS *Required* Your OmegaUp Password
58
60
  Optimist.options do
59
61
  opt :contest, 'Contest ShortName or identifier', type: :string
60
62
  end
63
+ when 'clarifications'
64
+ Optimist.options do
65
+ opt :contest, 'Contest ShortName or identifier', type: :string
66
+ opt :open, 'Filter to only open clars'
67
+ end
61
68
  # when 'create-contest'
62
69
  # Optimist.options do
63
70
  # opt :contest, 'Contest ShortName or identifier', type: :string
@@ -96,6 +103,8 @@ OMEGAUP_PASS *Required* Your OmegaUp Password
96
103
  user_data(@cmd_opts[:user])
97
104
  when 'scoreboard'
98
105
  scoreboard(@cmd_opts[:contest])
106
+ when 'clarifications'
107
+ clarifications(@cmd_opts[:contest], @cmd_opts[:open])
99
108
  end
100
109
  end
101
110
  end
@@ -28,6 +28,12 @@ module Omega
28
28
  puts omega.user(user).full_data.to_yaml
29
29
  end
30
30
 
31
+ def clarifications(contest_name, filter_open)
32
+ clarifications = omega.clarifications(contest_name)
33
+ clarifications.select! { |clar| clar[:answer].nil? || clar[:answer].empty? } if filter_open
34
+ puts clarifications.to_yaml
35
+ end
36
+
31
37
  def scoreboard(contest_name)
32
38
  score = omega.scoreboard(contest_name)
33
39
  score.simple_display.each_with_index { |s, i| puts "#{i + 1}.- #{s.values.join(': ')}" }
data/lib/omega/client.rb CHANGED
@@ -66,6 +66,11 @@ module Omega
66
66
  Scoreboard.new(self, data)
67
67
  end
68
68
 
69
+ def clarifications(name)
70
+ data = post('/api/contest/clarifications/', { contest_alias: name })
71
+ data[:clarifications]
72
+ end
73
+
69
74
  def user(user)
70
75
  data = post('/api/user/profile/', { username: user })
71
76
  User.new(self, data)
data/lib/omega/contest.rb CHANGED
@@ -16,6 +16,10 @@ module Omega
16
16
  end
17
17
  end
18
18
 
19
+ def clarifications
20
+ @client.clarifications(data[:alias])
21
+ end
22
+
19
23
  def observe
20
24
  last = current = scoreboard
21
25
  sleep(5)
data/lib/omega/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omega
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omegaup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilberto Vargas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-19 00:00:00.000000000 Z
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print