no drifting timestamps

This commit is contained in:
stjet
2026-01-18 18:47:31 +00:00
parent bd565cbe9c
commit 2184053eb5
2 changed files with 3 additions and 3 deletions

4
db.ts
View File

@@ -177,10 +177,10 @@ export async function edit_role_income(role_income_obj: RoleIncome) {
return await role_income.replaceOne({ role: role_income_obj.role }, role_income_obj); return await role_income.replaceOne({ role: role_income_obj.role }, role_income_obj);
} }
export async function update_role_income_last_claim(role: string) { export async function update_role_income_last_claim(role: string, last_claim: number, hours: number, cycles: number) {
return await role_income.updateOne({ role }, { return await role_income.updateOne({ role }, {
$set: { $set: {
last_claim: Date.now(), last_claim: last_claim + hours * cycles * 60 * 60 * 1000,
}, },
}); });
} }

View File

@@ -41,7 +41,7 @@ export default function main(client: Client) {
} }
}); });
//then update db with new latest claim time //then update db with new latest claim time
await update_role_income_last_claim(role_income.role); await update_role_income_last_claim(role_income.role, role_income.last_claim, role_income.hours, cycles);
} }
} }
role_income_poll(); role_income_poll();