🐛 Fix get perk subscription
This commit is contained in:
@@ -459,10 +459,15 @@ public class SubscriptionService(
|
|||||||
if (missingAccountIds.Count <= 0) return result;
|
if (missingAccountIds.Count <= 0) return result;
|
||||||
|
|
||||||
// If not in cache, get from database
|
// If not in cache, get from database
|
||||||
|
var now = SystemClock.Instance.GetCurrentInstant();
|
||||||
var subscriptions = await db.WalletSubscriptions
|
var subscriptions = await db.WalletSubscriptions
|
||||||
.Where(s => missingAccountIds.Contains(s.AccountId))
|
.Where(s => missingAccountIds.Contains(s.AccountId))
|
||||||
.Where(s => PerkIdentifiers.Contains(s.Identifier))
|
.Where(s => PerkIdentifiers.Contains(s.Identifier))
|
||||||
|
.Where(s => s.Status == SubscriptionStatus.Active)
|
||||||
|
.Where(s => s.EndedAt == null || s.EndedAt > now)
|
||||||
|
.OrderByDescending(s => s.BegunAt)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
subscriptions = subscriptions.Where(s => s.IsAvailable).ToList();
|
||||||
|
|
||||||
// Group the subscriptions by account id
|
// Group the subscriptions by account id
|
||||||
foreach (var subscription in subscriptions)
|
foreach (var subscription in subscriptions)
|
||||||
|
Reference in New Issue
Block a user