Skip to content

Commit d3edbd6

Browse files
committed
chore: declare inactiveAt variable and use it
1 parent 0af47b4 commit d3edbd6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

x/subscription/keeper/msg_handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,15 @@ func (k *Keeper) HandleMsgRenewSubscription(ctx sdk.Context, msg *v3.MsgRenewSub
139139
}
140140

141141
// Construct the renewed subscription with updated times and pricing
142+
inactiveAt := ctx.BlockTime().Add(plan.GetHours())
142143
subscription = v3.Subscription{
143144
ID: subscription.ID,
144145
AccAddress: subscription.AccAddress,
145146
PlanID: subscription.PlanID,
146147
Price: price,
147148
RenewalPricePolicy: subscription.RenewalPricePolicy,
148149
Status: v1base.StatusActive,
149-
InactiveAt: ctx.BlockTime().Add(plan.GetHours()),
150+
InactiveAt: inactiveAt,
150151
StartAt: ctx.BlockTime(),
151152
StatusAt: ctx.BlockTime(),
152153
}
@@ -323,14 +324,15 @@ func (k *Keeper) HandleMsgStartSubscription(ctx sdk.Context, msg *v3.MsgStartSub
323324

324325
// Build the subscription object with a new ID
325326
count := k.GetSubscriptionCount(ctx)
327+
inactiveAt := ctx.BlockTime().Add(plan.GetHours())
326328
subscription := v3.Subscription{
327329
ID: count + 1,
328330
AccAddress: accAddr.String(),
329331
PlanID: plan.ID,
330332
Price: price,
331333
RenewalPricePolicy: msg.RenewalPricePolicy,
332334
Status: v1base.StatusActive,
333-
InactiveAt: ctx.BlockTime().Add(plan.GetHours()),
335+
InactiveAt: inactiveAt,
334336
StartAt: ctx.BlockTime(),
335337
StatusAt: ctx.BlockTime(),
336338
}

0 commit comments

Comments
 (0)