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
All checks were successful
Test / build (push) Successful in 7s
This commit is contained in:
parent
a03a62277d
commit
f6c744cdcf
1 changed files with 5 additions and 3 deletions
|
@ -3,15 +3,17 @@ import CardConstants from "../constants/CardConstants";
|
||||||
import User from "../database/entities/app/User";
|
import User from "../database/entities/app/User";
|
||||||
|
|
||||||
export default async function GiveCurrency() {
|
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);
|
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.AddCurrency(CardConstants.TimerGiveAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
User.SaveAll(User, users);
|
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`);
|
||||||
}
|
}
|
Loading…
Reference in a new issue