Update the give currency timer to only give currency to those with less than 1000 currency
All checks were successful
Test / build (push) Successful in 7s

This commit is contained in:
Ethan Lane 2024-06-07 18:11:27 +01:00
parent a03a62277d
commit f6c744cdcf

View file

@ -3,15 +3,17 @@ import CardConstants from "../constants/CardConstants";
import User from "../database/entities/app/User";
export default async function GiveCurrency() {
AppLogger.LogInfo("Timers/GiveCurrency", "Giving currency to every known user");
AppLogger.LogDebug("Timers/GiveCurrency", "Giving currency to every known user");
const users = await User.FetchAll(User);
for (const user of users) {
const usersFiltered = users.filter(x => x.Currency < 1000);
for (const user of usersFiltered) {
user.AddCurrency(CardConstants.TimerGiveAmount);
}
User.SaveAll(User, users);
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${users.length} users`);
AppLogger.LogDebug("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${usersFiltered.length} users`);
}