Meteo Vercors : afficher le bulletin public sur la carte
Cette révision appartient à :
1 Parent
60be1e5193
révision
3f1e1621a3
5 fichiers modifiés
+127
-18
Aucun fichier ne correspond à votre recherche
@@ -226,6 +226,20 @@ class Forum:
|
||||
" WHERE p.topic_id=? AND (p.hidden=0 OR ?) ORDER BY p.id", (topic_id, int(voit))).fetchall()
|
||||
return t, msgs
|
||||
|
||||
def a_la_une(self):
|
||||
"""Dernier bulletin visible par un visiteur et nombre de nouveaux sujets publics sur sept jours."""
|
||||
bulletin = self.con.execute(
|
||||
"SELECT t.id AS sujet, t.title AS titre, p.body AS corps, u.display_name AS auteur"
|
||||
" FROM topics t JOIN posts p ON p.topic_id=t.id JOIN users u ON u.id=p.author_id"
|
||||
" WHERE t.fixed=1 AND t.status='publie' AND t.hidden=0 AND p.hidden=0"
|
||||
" ORDER BY p.id DESC LIMIT 1"
|
||||
).fetchone()
|
||||
n = self.con.execute(
|
||||
"SELECT COUNT(*) FROM topics WHERE fixed=0 AND status='publie' AND hidden=0"
|
||||
" AND created_at >= datetime('now', '-7 days')"
|
||||
).fetchone()[0]
|
||||
return bulletin, n
|
||||
|
||||
def en_attente(self, user):
|
||||
self._exiger(user, "valider_sujet")
|
||||
return self.con.execute("SELECT t.*, u.display_name AS auteur FROM topics t JOIN users u ON u.id=t.author_id"
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur