Another bugfix

This commit is contained in:
kagel 2016-08-31 04:49:26 +03:00
parent 1dd6be2180
commit 99705264ea
2 changed files with 8 additions and 4 deletions

View File

@ -101,11 +101,12 @@ RETURNING repo_id, issue_id, issue_number, title, address, commit_id;
-- :name create-pull-request! :! :n -- :name create-pull-request! :! :n
-- :doc creates pull request -- :doc creates pull request
INSERT INTO pull_requests (repo_id, pr_id, pr_number, user_id) INSERT INTO pull_requests (repo_id, pr_id, pr_number, commit_id, user_id)
SELECT SELECT
:repo_id, :repo_id,
:pr_id, :pr_id,
:pr_number, :pr_number,
:commit_id,
:user_id :user_id
WHERE NOT exists(SELECT 1 WHERE NOT exists(SELECT 1
FROM pull_requests FROM pull_requests

View File

@ -11,14 +11,17 @@
(def label-name "bounty") (def label-name "bounty")
(defn find-issue-event (defn find-issue-event
[events type] [events type owner]
(first (filter #(= type (:event %)) events))) (first (filter #(and
(= owner (get-in % [:actor :login]))
(= type (:event %)))
events)))
(defn find-commit-id (defn find-commit-id
[user repo issue-number event-type] [user repo issue-number event-type]
(-> (->
(github/get-issue-events user repo issue-number) (github/get-issue-events user repo issue-number)
(find-issue-event event-type) (find-issue-event event-type user)
(:commit_id))) (:commit_id)))
(defn handle-issue-closed (defn handle-issue-closed