Skip to content

use preferred name #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2025
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
11 changes: 6 additions & 5 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,28 +833,30 @@
// return validCSV;
// };


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

Check failure on line 842 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 845 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

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

Check failure on line 846 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, legalFirstName },
basicInfo: { email, legalFirstName, preferredName },
dayOf,
} = doc.data();

Check failure on line 853 in utility/firebase.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`

if (!dayOf?.events || !Array.isArray(dayOf.events)) continue;

// Determine the name to use
const displayName = preferredName?.trim() || legalFirstName;

// Fetch event documents for each event in dayOf.events
const dayOfDocsPromises = dayOf.events.map((e) =>
db
Expand All @@ -877,12 +879,12 @@

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

// Prepare CSV with "Number", "First Name + Number", and "Email" columns
// Prepare CSV with "Number", "First Name + Number", and "Raffle Entries" columns
const CSV = [
['Number', 'Name + Number', 'Raffle Entries'],
...raffleEntries,
Expand All @@ -894,7 +896,6 @@
};



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