mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Improve handling
This commit is contained in:
committed by
Phillip Thelen
parent
0f7001b609
commit
82a1d6ff0e
@@ -246,12 +246,11 @@ async function createSubscription (data) {
|
||||
} = await prepareSubscriptionValues(data);
|
||||
|
||||
// Block sub perks
|
||||
const perks = Math.floor(months / 3);
|
||||
if (perks) {
|
||||
plan.consecutive.offset += months;
|
||||
plan.consecutive.gemCapExtra += perks * 5;
|
||||
if (plan.consecutive.gemCapExtra > 25) plan.consecutive.gemCapExtra = 25;
|
||||
await plan.updateHourglasses(recipient._id, perks, 'subscription_perks'); // one Hourglass every 3 months
|
||||
if (months > 0) {
|
||||
if (!data.gift && !groupId) {
|
||||
plan.consecutive.offset = months;
|
||||
}
|
||||
await plan.incrementPerkCounterAndReward(recipient._id, months);
|
||||
}
|
||||
|
||||
if (recipient !== group) {
|
||||
|
||||
Reference in New Issue
Block a user