Skip to content

Commit

Permalink
EDF: [premieroctet#174] take ticket status into account for registere…
Browse files Browse the repository at this point in the history
…d users count in event schema
  • Loading branch information
Bastien-Wappizy committed Dec 26, 2024
1 parent ded51c6 commit 6ff979a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/web/server/plugins/entreprisedufutur/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const getRegistered = async function (userId, params, data,fields) {
return users.map(u=> new User(u))
}

const getRegisteredNumber = async function (userId, params, data) {
const getRegisteredNumber = async function (userId, params, data,fields) {
const eventTickets = await EventTicket.find({event: data._id})
const eventTicketIds = eventTickets.map(ticket => ticket._id)
const userTickets = await UserTicket.find({event_ticket: {$in: eventTicketIds}})
const userTickets = await UserTicket.find({event_ticket: {$in: eventTicketIds}, status: {$in: [USERTICKET_STATUS_PAYED, USERTICKET_STATUS_PENDING_PAYMENT,USERTICKET_STATUS_REGISTERED]}})
return userTickets.map(ticket=> ticket.user).length
}

Expand Down

0 comments on commit 6ff979a

Please sign in to comment.