Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
grobolom committed May 29, 2017
1 parent 343a968 commit 93d2cd8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scrounger/app/scrounger.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def teams():
_items = db.gitdb.teams.find()
items = [item for item in _items]

headers = {}
headers["Content-Type"] = "application/json"
headers['Access-Control-Allow-Origin'] = '*'
headers = {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
}

return dumps(items), 200, headers
else:
Expand All @@ -61,9 +62,10 @@ def teams_issues(name):

items = [item for item in _items]

headers = {}
headers["Content-Type"] = "application/json"
headers['Access-Control-Allow-Origin'] = '*'
headers = {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
}

return dumps(items), 200, headers

Expand All @@ -74,7 +76,7 @@ def update():
url = 'https://api.github.com/graphql'
headers = {'Authorization': 'Bearer {}'.format(TOKEN)}

issues = {}
new_issues = {}
for org in ORGS_TO_TRACK:
logger.debug('finding all issues in {}'.format(org))

Expand All @@ -84,11 +86,11 @@ def update():
resp = flatten_response(r.json())

logger.debug('found {} issues for {}'.format(len(resp), org))
issues.update(resp)
new_issues.update(resp)

logger.debug('dropping all issues and updating')
db.gitdb.everything.delete_many({})
db.gitdb.everything.insert_many(list(issues.values()))
db.gitdb.everything.insert_many(list(new_issues.values()))

return 'success'

Expand Down

0 comments on commit 93d2cd8

Please sign in to comment.