fix: fix bynote

This commit is contained in:
Nemo D'ACREMONT 2024-12-02 15:05:55 +01:00
parent 4567285ec4
commit f5af049dbb
No known key found for this signature in database
GPG Key ID: 6E5BCE8022FA8276

View File

@ -68,10 +68,11 @@ const getAllModelsByNote = async () => {
await client.connect(); await client.connect();
const res = await client.query( const res = await client.query(
"SELECT * FROM noter GROUP BY id_modele ORDER BY AVG(note_noter) DESC" "SELECT modeles.*, AVG(note_noter) as note_moyenne FROM noter JOIN modeles on noter.id_modele = modeles.id_modele GROUP BY modeles.id_modele ORDER BY note_moyenne DESC;"
); );
await client.end(); await client.end();
console.log(res);
return res.rows.map(db2Model); return res.rows.map(db2Model);
} }