mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 02:20:17 +01:00
ajout fct getStats
This commit is contained in:
@@ -80,11 +80,11 @@ const getnotesautresfromreview = (reviewid) => {
|
||||
|
||||
const getStats = (interval, limit) => {
|
||||
return new promise((resolve, reject) => {
|
||||
let sql = `select borne_notes_autre.id,borne_criteres.nom as critere, note, avis_id
|
||||
from borne_notes_autre
|
||||
join borne_criteres on borne_criteres.id = critere_id
|
||||
where avis_id = ?
|
||||
order by borne_notes_autre.id desc`;
|
||||
if(!["jour","mois","semaine","annee"].includes(interval)) {
|
||||
reject(new Error("Invalid time interval"));
|
||||
return;
|
||||
}
|
||||
let sql = `SELECT * FROM stats_general_${interval} ORDER BY id DESC LIMIT ?;`;
|
||||
conn.query(sql, [limit], (err, res) => {
|
||||
if(err) {
|
||||
reject(err);
|
||||
|
||||
Reference in New Issue
Block a user