Skip to content

Commit e9c84c6

Browse files
committed
Fix query for tracking number of community auth logins
Embarassing thinko would cap the number of logins at 2...
1 parent 0f4ae76 commit e9c84c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pgweb/account/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def communityauth(request, siteid):
528528
# Record the login as the last login to this site. Django doesn't support tables with
529529
# multi-column PK, so we have to do this in a raw query.
530530
with connection.cursor() as curs:
531-
curs.execute("INSERT INTO account_communityauthlastlogin (user_id, site_id, lastlogin, logincount) VALUES (%(userid)s, %(siteid)s, CURRENT_TIMESTAMP, 1) ON CONFLICT (user_id, site_id) DO UPDATE SET lastlogin=CURRENT_TIMESTAMP, logincount=EXCLUDED.logincount+1", {
531+
curs.execute("INSERT INTO account_communityauthlastlogin (user_id, site_id, lastlogin, logincount) VALUES (%(userid)s, %(siteid)s, CURRENT_TIMESTAMP, 1) ON CONFLICT (user_id, site_id) DO UPDATE SET lastlogin=CURRENT_TIMESTAMP, logincount=account_communityauthlastlogin.logincount+1", {
532532
'userid': request.user.id,
533533
'siteid': site.id,
534534
})

0 commit comments

Comments
 (0)