This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rough in UI for identifications; #449
- Loading branch information
1 parent
11ab548
commit 6fe538f
Showing
12 changed files
with
253 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"""Endpoint to record identifications | ||
""" | ||
from aspen import Response | ||
from gittip import db | ||
from gittip.utils import get_participant | ||
|
||
# ================= ^L | ||
|
||
request.allow('GET', 'POST') | ||
participant = get_participant(request) | ||
if user == participant: | ||
raise Response(400) | ||
if not participant.type == 'open company': | ||
raise Response(400) | ||
|
||
group = participant.username | ||
|
||
if POST: | ||
member = body['member'] | ||
weight = body['weight'] | ||
db.execute(""" | ||
|
||
INSERT | ||
INTO identifications (ctime, member, "group", weight, identified_by) | ||
VALUES ( COALESCE (( SELECT ctime | ||
FROM identifications | ||
WHERE member=%s | ||
AND "group"=%s | ||
LIMIT 1 | ||
), CURRENT_TIMESTAMP) | ||
, %s | ||
, %s | ||
, %s | ||
, %s | ||
); | ||
|
||
""", (member, group, member, group, weight, user.username)) | ||
|
||
identifications = db.fetchall(""" | ||
|
||
SELECT * FROM ( | ||
SELECT DISTINCT ON (member, "group", identified_by) | ||
member AS username | ||
, weight | ||
FROM identifications | ||
WHERE "group"=%s | ||
AND identified_by=%s | ||
ORDER BY member, "group", identified_by, mtime DESC | ||
) AS anon WHERE weight > 0 ORDER BY weight DESC, username | ||
|
||
""", (group, user.username)) | ||
|
||
response.body = { "identifications": list(identifications) | ||
, "split": participant.compute_split() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"""Endpoint to record identifications | ||
""" | ||
from gittip.utils import get_participant | ||
|
||
# ================= ^L | ||
|
||
participant = get_participant(request, restrict=False) | ||
response.body = participant.compute_split() |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.