fix(quotas): Time value of a quota was being ignored

This commit is contained in:
Jono Cairns
2021-04-10 13:10:43 +12:00
committed by GitHub
parent 9b199b27d8
commit d3c6bc1619
2 changed files with 4 additions and 8 deletions

View File

@@ -236,11 +236,9 @@ export class User {
const movieDate = new Date();
if (movieQuotaDays) {
movieDate.setDate(movieDate.getDate() - movieQuotaDays);
} else {
movieDate.setDate(0);
}
// YYYY-MM-DD format
const movieQuotaStartDate = movieDate.toJSON().split('T')[0];
const movieQuotaStartDate = movieDate.toJSON();
const movieQuotaUsed = movieQuotaLimit
? await requestRepository.count({
where: {
@@ -261,11 +259,8 @@ export class User {
const tvDate = new Date();
if (tvQuotaDays) {
tvDate.setDate(tvDate.getDate() - tvQuotaDays);
} else {
tvDate.setDate(0);
}
// YYYY-MM-DD format
const tvQuotaStartDate = tvDate.toJSON().split('T')[0];
const tvQuotaStartDate = tvDate.toJSON();
const tvQuotaUsed = tvQuotaLimit
? (
await requestRepository