Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed May 19, 2024
1 parent bb3a053 commit 710d0e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

label = 'bug'

fb.query("(and (eq what 'label-attached')
(exists issue)
(exists repository)
(eq label '#{label}'))").each do |f1|
(exists label))").each do |f1|
$loog.debug("Label '#{f1.label}' was attached to issue ##{f1.issue}")
once(fb).query("(and (eq what 'issue-closed')
(exists who)
(eq issue #{f1.issue})
(eq repository #{f1.repository}))").each do |f2|
fb.txn do |fbt|
n = follow(fbt, f1, %w[repository issue])
n.what = 'bug-was-closed'
n.what = 'issue-was-closed'
n.who = f2.who
n.details =
"In the repository ##{n.repository}, the issue ##{n.issue}" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ input:
what: label-attached
issue: 42
repository: 555
label: bug
label: question
-
what: issue-closed
issue: 42
Expand All @@ -32,7 +32,7 @@ input:
expected:
- /fb[count(f)=3]
- /fb/f[time]
- /fb/f[what='bug-was-closed']
- /fb/f[what='issue-was-closed']
- /fb/f[who='777']
- /fb/f[repository='555']
- /fb/f[issue='42']
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
# SOFTWARE.

once(fb).query("(and
(eq what 'bug-was-closed')
(eq what 'issue-was-closed')
(exists issue)
(exists repository)
(exists who))").each do |f|
$loog.debug("Bug was closed in the issue ##{f.issue}")
$loog.debug("The issue ##{f.issue} was closed")
fb.txn do |fbt|
n = follow(fbt, f, %w[repository issue who])
n.what = 'reward-for-closed-bug'
n.what = 'reward-for-closed-issue'
n.award = 5
n.reason =
"@#{n.who} thanks for closing this bug! " \
"@#{n.who} thanks for closing this issue! " \
"You've earned #{n.award} points for this. "
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
---
input:
-
what: bug-was-closed
what: issue-was-closed
who: 4444
issue: 42
repository: 100
Expand All @@ -31,7 +31,7 @@ input:
- three
expected:
- /fb[count(f)=2]
- /fb/f[what='reward-for-closed-bug']
- /fb/f[what='reward-for-closed-issue']
- /fb/f[who='4444']
- /fb/f[issue='42']
- /fb/f[repository='100']
Expand Down

0 comments on commit 710d0e7

Please sign in to comment.