Skip to content

Commit

Permalink
Merge pull request #146 from diggyk/fix-notify
Browse files Browse the repository at this point in the history
Notify quest owners when they have open labors
  • Loading branch information
kelseyfix committed Feb 22, 2016
2 parents 719e35f + 9b8a945 commit e1e1333
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions bin/hermes-notify
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def find_quest(quests, quest_id):
if quest.id == quest_id:
return quest


return None


def main():
args = parse_args()
settings.update_from_config(args.config)
Expand Down Expand Up @@ -115,12 +115,21 @@ def main():
# map the labors and quests to owners
info = {}
for labor in open_labors:
if not labor.for_owner:
if labor.for_creator and not labor.quest:
# FIXME: what should we do here? See Issue #145
continue
if owners[labor.host.hostname] not in info:
elif labor.for_creator and labor.quest:
if labor.quest.creator not in info:
info[labor.quest.creator] = {}

# if this is our first time seeing this owner, create the empty record
elif owners[labor.host.hostname] not in info:
info[owners[labor.host.hostname]] = {}

owner = info[owners[labor.host.hostname]]
owner = (
info[owners[labor.host.hostname]] if labor.for_owner
else info[labor.quest.creator]
)

quest_id = labor.quest_id if labor.quest else 0
if quest_id not in owner:
Expand Down

0 comments on commit e1e1333

Please sign in to comment.