Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions utility/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@
return CSV
}


Check failure on line 757 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `⏎`
// export const getRaffleNumbers = async () => {
// const apps = await db
// .collection('Hackathons')
Expand Down Expand Up @@ -789,10 +789,10 @@
// .doc(e.eventId)
// .get()
// );

Check failure on line 792 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `······`
// // Wait for all dayOfDocs to resolve
// const dayOfDocs = await Promise.all(dayOfDocsPromises);

Check failure on line 795 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `······`
// // Calculate total points from events
// const totalPoints = dayOfDocs.reduce(
// (acc, curr) => acc + Number(curr.data()?.points ?? 0),
Expand Down Expand Up @@ -833,22 +833,23 @@
// return validCSV;
// };


Check failure on line 836 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `⏎`
export const getRaffleWheelEmails = async () => {
const apps = await db
.collection('Hackathons')
.doc(HackerEvaluationHackathon)
.collection('Applicants')
.where('dayOf.checkedIn', '==', true)
.get();

Check failure on line 843 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`

// Create an array to hold all rows for the raffle entries
const raffleEntries = [];

Check failure on line 846 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`
let counter = 1; // Initialize a counter

Check failure on line 847 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`

// Iterate over the documents and calculate raffle entries for each user
for (const doc of apps.docs) {
const {
basicInfo: { email },
basicInfo: { email, legalFirstName },
dayOf,
} = doc.data();

Expand All @@ -866,26 +867,25 @@

const dayOfDocs = await Promise.all(dayOfDocsPromises);

// Calculate total points from events
// +15 is from check in : cmd-f 2025
const totalPoints = 15 + dayOfDocs.reduce(
(acc, curr) => acc + Number(curr.data()?.points ?? 0),
0
);
// Calculate total points from events (+15 from check-in)
const totalPoints =
15 +
dayOfDocs.reduce((acc, curr) => acc + Number(curr.data()?.points ?? 0), 0);

// Calculate raffle entries based on total points
const totalRaffleEntries = Math.floor(totalPoints / 15);

// Add the user's email multiple times based on raffle entries
// Add the user's data multiple times based on raffle entries
for (let i = 0; i < totalRaffleEntries; i++) {
raffleEntries.push(email); // Repeat the email for each raffle entry
raffleEntries.push([counter, `${legalFirstName} ${counter}`, email]);
counter++; // Increment counter
}
}

// Prepare CSV with only the "Raffle Entries" column
// Prepare CSV with "Number", "First Name + Number", and "Email" columns
const CSV = [
['Raffle Entries'],
...raffleEntries.map(email => [email]), // Convert to array format for CSV
['Number', 'Name + Number', 'Raffle Entries'],
...raffleEntries,
];

console.log(CSV);
Expand All @@ -894,6 +894,7 @@
};



export const getResumeFile = async userId => {
try {
const ref = storage.ref(`applicantResumes/${userId}`)
Expand Down
Loading