fix: return latest N months in getMonthlyHistory (#6)
This commit is contained in:
@@ -205,12 +205,12 @@ function getMonthlyHistory(pdgaNumber, months = 12) {
|
||||
WHERE player_id = ?
|
||||
GROUP BY strftime('%Y-%m', date)
|
||||
)
|
||||
ORDER BY date ASC
|
||||
ORDER BY date DESC
|
||||
LIMIT ?`,
|
||||
[player.id, player.id, months],
|
||||
(err, rows) => {
|
||||
if (err) return reject(err);
|
||||
resolve(rows.map(r => r.rating));
|
||||
resolve(rows.map(r => r.rating).reverse());
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user