Skip to content

Commit

Permalink
automated lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf committed Nov 22, 2023
1 parent 749b943 commit db249fc
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions src/server/controllers/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,30 @@ export async function list(req, res, next) {
}
`;
const vars = { collectiveSlug: eventSlug || collectiveSlug, limit: 1000 };
if (role === 'attendees') vars.role = 'ATTENDEE';
if (role === 'followers') vars.role = 'FOLLOWER';
if (role === 'organizers') vars.role = 'ADMIN';
if (tierSlug) vars.tierSlug = tierSlug;
if (backerType) vars.backerType = backerType;
if (req.query.TierId) vars.TierId = Number(req.query.TierId);
if (req.query.limit) vars.limit = Number(req.query.limit);
if (req.query.offset) vars.offset = Number(req.query.offset);
if (role === 'attendees') {
vars.role = 'ATTENDEE';
}
if (role === 'followers') {
vars.role = 'FOLLOWER';
}
if (role === 'organizers') {
vars.role = 'ADMIN';
}
if (tierSlug) {
vars.tierSlug = tierSlug;
}
if (backerType) {
vars.backerType = backerType;
}
if (req.query.TierId) {
vars.TierId = Number(req.query.TierId);
}
if (req.query.limit) {
vars.limit = Number(req.query.limit);
}
if (req.query.offset) {
vars.offset = Number(req.query.offset);
}

let result;
try {
Expand All @@ -116,10 +132,18 @@ export async function list(req, res, next) {
const members = result.Collective.members;

const isActive = (r) => {
if (!r.tier || !r.tier.interval) return true;
if (!r.transactions[0] || !r.transactions[0].createdAt) return false;
if (r.tier.interval === 'month' && days(new Date(r.transactions[0].createdAt)) <= 60) return true;
if (r.tier.interval === 'year' && days(new Date(r.transactions[0].createdAt)) <= 365) return true;
if (!r.tier || !r.tier.interval) {
return true;
}
if (!r.transactions[0] || !r.transactions[0].createdAt) {
return false;
}
if (r.tier.interval === 'month' && days(new Date(r.transactions[0].createdAt)) <= 60) {
return true;
}
if (r.tier.interval === 'year' && days(new Date(r.transactions[0].createdAt)) <= 365) {
return true;
}
return false;
};

Expand Down

0 comments on commit db249fc

Please sign in to comment.