g.db.execute('delete from user_group where id_user = ? and id_group = ?', [iduser, group['id']])
g.db.commit()
for group in groups:
- group = query_db('select id from groups where id = ?', group, one=True)
+ group = query_db('select id from groups where id = ?', [group], one=True)
if group is None:
flash(u'Le groupe portant l\'id %s n\'existe pas.' % group, 'warning')
else:
group by id_group', [vote['id_group']], one=True)
if max_votes is None:
vote['percent'] = 0
+ vote['nb_votes'] = 0
else:
vote['max_votes'] = max_votes['nb']
votes = query_db('select id_vote, count(*) as nb \
cardinal_values = cardinals[cardinal]['values']
weight = cardinals[cardinal]['first'] if not cardinals[cardinal]['first'] is None else -(cardinal/2)
if query_db('select * from cardinals where id = ?', [cardinal], one=True) is None:
- g.db.execute('insert into cardinals (id, name) values (?, ?)', [len(cardinal_values), cardinal_name])
+ g.db.execute('insert into cardinals (id, name, first) values (?, ?, ?)', [len(cardinal_values), cardinal_name, weight])
g.db.commit()
for name in cardinal_values:
g.db.execute('insert into values_ (id_cardinal, name, weight) values (?, ?, ?)'