From: Arnaud Delcasse Date: Thu, 30 Aug 2012 08:44:42 +0000 (+0200) Subject: Fix problem of publisher again X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/%27http:/ie7-js.googlecode.com/svn/test/index.html/%40%20%27config_titre_base_sup%27%20=%3E%20%27Declaration%20of%20an%20additional%20database%27%2C%20%27config_titre_base_sup_choix%27%20=%3E%20%27Choose%20an%20additional%20database%27%2C%20%27connexion_ldap%27%20=%3E%20%27Connection:%27%2C-%27copier_en_local%27%20=%3E%20%27Copy%20to%20local%20site%27%2C%20%27creer_et_associer_un_auteur%27%20=%3E%20%27Create%20and%20associate%20an%20author%27%2C-%27creer_et_associer_une_rubrique%27%20=%3E%20%27Create%20and%20link%20a%20section%27%2C%20%20/%20D%20%27date_mot_heures%27%20=%3E%20%27H%27%2C%40%40%20-141%2C7%20%20113%2C6%20%40%40%20Do%20not%20submit%20this%20import%20request.%3Cp%3EFor%20more%20information%2C%20please%20see%20%3Ca%20href=?a=commitdiff_plain;h=af86f1aa2f19d4ebb51217983eb6935befe595ed;p=cavote.git Fix problem of publisher again --- diff --git a/main.py b/main.py index dc2259d..da9316b 100755 --- 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/', 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()):