mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-01-21 04:30:22 -06:00
fix: #1167 Validation error fixed.
This commit is contained in:
@@ -9,9 +9,14 @@ module.exports.update = async (ping, download, upload) => {
|
||||
const configuration = {ping: Math.round(ping), download: parseFloat(download.toFixed(2)),
|
||||
upload: parseFloat(upload.toFixed(2))};
|
||||
|
||||
await recommendations.destroy({truncate: true});
|
||||
|
||||
const existing = await recommendations.findOne();
|
||||
|
||||
triggerEvent("recommendationsUpdated", configuration).then(() => {});
|
||||
|
||||
if (existing) {
|
||||
await recommendations.update(configuration, {where: {id: existing.id}});
|
||||
return recommendations.findOne({where: {id: existing.id}});
|
||||
}
|
||||
|
||||
return recommendations.create(configuration);
|
||||
}
|
||||
Reference in New Issue
Block a user