Fix problem of publisher again
authorArnaud Delcasse <arnaud@delcasse.fr>
Thu, 30 Aug 2012 08:44:42 +0000 (10:44 +0200)
committerArnaud Delcasse <arnaud@delcasse.fr>
Thu, 30 Aug 2012 08:44:42 +0000 (10:44 +0200)
main.py

diff --git a/main.py b/main.py
index dc2259d..da9316b 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -381,7 +381,7 @@ def votes(votes):
     basequery = 'select votes.*, max_votes from votes left join (' + max_votes + ') as max_votes on votes.id_group = max_votes.id_group'
     nb_votes = 'select id_vote, count(*) as nb_votes from (select id_user, id_vote from user_choice join choices on id_choice = choices.id group by id_user, id_vote) group by id_vote'
     basequery = 'select * from (' + basequery + ') left join (' + nb_votes + ') on id = id_vote'
-    basequery = 'select *, votes.id as voteid, groups.name as groupname, users.name as author from (' + basequery + ') as votes join groups on groups.id = id_group join users on users.id = id_author where is_open=1'
+    basequery = 'select *, votes.id as voteid, groups.name as groupname from (' + basequery + ') as votes join groups on groups.id = id_group where is_open=1'
     if votes == 'all':
         votes = query_db(basequery + ' order by date_end')
     elif votes == 'archive':
@@ -432,7 +432,7 @@ def has_voted(idvote, iduser=-1):
 
 @app.route('/vote/<idvote>', methods=['GET', 'POST'])
 def vote(idvote):
-    vote = query_db('select votes.*, groups.name as groupname from votes join groups on groups.id=votes.id_group where votes.id=?', [idvote], one=True)
+    vote = query_db('select votes.*, groups.name as groupname, users.name as author from votes join groups on groups.id=votes.id_group join users on users.id = id_author where votes.id=?', [idvote], one=True)
     if vote is None:
         abort(404)
     if can_see_vote(idvote, get_userid()):