Skip to content

Commit 26df52c

Browse files
endDateLimit to courses count
1 parent 86437db commit 26df52c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

importer-db-api/src/routes/apparaatti/apparaatti.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,15 @@ router.get('/courses', async (req, res) => {
106106
router.get('/courses/count', async (req, res) => {
107107
const courseStartTreshold = addMonths(new Date(), 48)
108108

109+
const endDateLimit = new Date()
110+
endDateLimit.setFullYear(endDateLimit.getFullYear() - 1)
111+
109112
const courseUnitRealisationsCount = await models.CourseUnitRealisation.count({
110113
where: {
111114
[Op.and]: [
112115
{
113116
'activityPeriod.endDate': {
114-
[Op.gte]: new Date()
117+
[Op.gte]: endDateLimit
115118
}
116119
},
117120
{

0 commit comments

Comments
 (0)