Beispiel #1
0
def resolve_issue(house_name, user_id, date):
    pigeon_key = ndb.Key(Pigeon, user_id)
    house_list = House.query(House.name == house_name).fetch()
    house_key = house_list[0].key
    issue_list = Issue.query(Issue.pigeon_key == pigeon_key,
                             Issue.house_key == house_key,
                             Issue.date_str == date).fetch()
    if issue_list:
        issue = issue_list[0]
        issue.key.delete()
        return
    else:
        return
Beispiel #2
0
def show_all_issues(house_name):
    house_list = House.query(House.name == house_name).fetch()
    house_key = house_list[0].key
    issue_list = Issue.query(Issue.house_key == house_key).order(
        Issue.date).fetch()
    if issue_list:
        return map(
            lambda s: {
                "user_id": s.pigeon_key.get().pigeon_id,
                "content": s.comment,
                "date": s.date_str
            }, issue_list)
    else:
        return