Skip to content

Commit

Permalink
fix(application): allow people to apply in 2022 as well (#285)
Browse files Browse the repository at this point in the history
Co-authored-by: WikiRik <WikiRik@users.noreply.github.com>
  • Loading branch information
WikiRik and WikiRik authored Apr 1, 2022
1 parent 29e91b2 commit 26c7b63
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const moment = require('moment');

const constants = require('./constants');
const { Application } = require('../models');
const { Application, Event } = require('../models');
const { Sequelize } = require('./sequelize');

// A helper to get default search/query/pagination filter for events listings.
Expand Down Expand Up @@ -230,12 +230,18 @@ exports.getEventPermissions = async ({ permissions, event, user }) => {
permissions.delete_summeruniversity = permissions.manage_summeruniversity[event.type];

if (user) {
// TODO: this is a temporary solution so people that have applied in 2021 can apply again
const applicationCount = await Application.count({ where: {
user_id: user.id,
event_id: { [Sequelize.Op.ne]: event.id },
status: { [Sequelize.Op.ne]: 'rejected' },
cancelled: false
} });
cancelled: false,
'$event.season$': 2022
},
include: [{
model: Event,
required: true
}] });

const acceptedForEvent = await Application.count({ where: {
user_id: user.id,
Expand Down

0 comments on commit 26c7b63

Please sign in to comment.