fbe 0.0.38 → 0.0.39

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: e69702483c25c55333a0391946414e8204e5116c47af9ce6c76736f30ac60e09
4
- data.tar.gz: 5d868159c91bd6c58d6b6be8c5ba25c1138c0191cf5b915044a49b170342a36e
3
+ metadata.gz: 32f31aad59acf471e8f0075c5ed1d0449a2039fb7d13cd3e0b4c3804b6ef1271
4
+ data.tar.gz: 65356a4c23c7a6630a0c0387a511cd0d367c72eb2609cb3ded007f9efacbf6e9
5
5
  SHA512:
6
- metadata.gz: 0c7ed04c82fe5f4c1fe28a127113ab65bc539db0079bb097ebb9979ba2cb521f37a4f5b6ee16aab51f8eac2e67e3da2bbba2f28372218a4a17de6c767514edf4
7
- data.tar.gz: 4dc676859c6a144bd405808180a63c23bebd61423dc6d009a752a983c4267786b170e6d50758f98896adeb699d775ed75d9978dbf3dc90d0dbd56faee9502a15
6
+ metadata.gz: b50e3e2aaf0a16e640c8dc8068574fdb2dac380b767b00b2ae348c58a7ce0940b4db5dd85719aa263ee19ef5c2d402afef9a41cd31637f9a0e4418415a18ebc5
7
+ data.tar.gz: 732aedff1ade21b5db01cf591ad343889e234fd7e646d4012c399c9f053651fb220b5c9a746de63bff129efa37614d99c5ef9842fa688b4a7abda687d7c49d06
data/lib/fbe/regularly.rb CHANGED
@@ -25,11 +25,9 @@
25
25
  require_relative '../fbe'
26
26
  require_relative 'fb'
27
27
 
28
- def Fbe.regularly(area, days, interval, fb: Fbe.fb, judge: $judge, loog: $loog, &)
29
- pmp = fb.query("(and (eq what 'pmp') (eq area '#{area}') (exists #{days}))").each.to_a.first
30
- days = pmp.nil? ? 28 : pmp[days].first
31
- since = Time.now - (days * 24 * 60 * 60)
32
- interval = pmp.nil? ? 7 : pmp[interval].first
28
+ def Fbe.regularly(area, p_every_days, p_since_days = nil, fb: Fbe.fb, judge: $judge, loog: $loog, &)
29
+ pmp = fb.query("(and (eq what 'pmp') (eq area '#{area}') (exists #{p_every_days}))").each.to_a.first
30
+ interval = pmp.nil? ? 7 : pmp[p_every_days].first
33
31
  unless fb.query(
34
32
  "(and
35
33
  (eq what '#{judge}')
@@ -41,6 +39,10 @@ def Fbe.regularly(area, days, interval, fb: Fbe.fb, judge: $judge, loog: $loog,
41
39
  f = fb.insert
42
40
  f.what = judge
43
41
  f.when = Time.now
44
- f.since = since
42
+ unless p_since_days.nil?
43
+ days = pmp.nil? ? 28 : pmp[p_since_days].first
44
+ since = Time.now - (days * 24 * 60 * 60)
45
+ f.since = since
46
+ end
45
47
  yield f
46
48
  end
data/lib/fbe.rb CHANGED
@@ -27,5 +27,5 @@
27
27
  # License:: MIT
28
28
  module Fbe
29
29
  # Current version of the gem (changed by .rultor.yml on every release)
30
- VERSION = '0.0.38'
30
+ VERSION = '0.0.39'
31
31
  end
@@ -23,6 +23,7 @@
23
23
  # SOFTWARE.
24
24
 
25
25
  require 'minitest/autorun'
26
+ require 'loog'
26
27
  require_relative '../test__helper'
27
28
  require_relative '../../lib/fbe/award'
28
29
 
@@ -58,7 +59,8 @@ class TestAward < Minitest::Test
58
59
  (set b2 (if (lt b2 at_least) b2 0))
59
60
  (set b2 (between b2 3 120))
60
61
  (give b2 "for holding the bug open for too long (${days} days)"))
61
- '
62
+ ',
63
+ judge: '', global: {}, loog: Loog::NULL, options: nil
62
64
  )
63
65
  b = a.bill(hours: 10)
64
66
  assert(b.points <= 100)
@@ -38,7 +38,7 @@ class TestRegularly < Minitest::Test
38
38
  loog = Loog::NULL
39
39
  judge = 'test'
40
40
  2.times do
41
- Fbe.regularly('pmp', 'days', 'interval', fb:, loog:, judge:) do |f|
41
+ Fbe.regularly('pmp', 'interval', 'days', fb:, loog:, judge:) do |f|
42
42
  f.foo = 42
43
43
  end
44
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.38
4
+ version: 0.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko