Skip to content

Commit 3de63af

Browse files
committed
a
1 parent 8482939 commit 3de63af

2 files changed

Lines changed: 37 additions & 10 deletions

File tree

public/.htaccess

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
<IfModule mod_rewrite.c>
22
RewriteEngine On
33

4-
4+
# 0) Let real files pass through (but NOT directories)
5+
RewriteCond %{REQUEST_FILENAME} -f
6+
RewriteRule ^ - [L]
57

68
# 1) If a directory-style path has an index.html, serve it
79
# (works for any depth, with or without a trailing slash)
810
RewriteCond %{REQUEST_FILENAME}/index.html -f
911
RewriteRule ^(.+?)/?$ $1/index.html [L]
1012

11-
# 0) Let real files/dirs pass through
12-
RewriteCond %{REQUEST_FILENAME} -f [OR]
13-
RewriteCond %{REQUEST_FILENAME} -d
14-
RewriteRule ^ - [L]
15-
1613
# 2) Canonicalize: if index.html exists but URL lacks trailing slash, redirect to add it
1714
RewriteCond %{REQUEST_FILENAME} !-f
1815
RewriteCond %{REQUEST_FILENAME}/index.html -f

public/member/eidStats.js

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ export async function fetchMemberInfo(eid) {
115115
throw new Error('Failed to load membership data');
116116
}
117117

118-
// Check if any data was returned
119-
const memberExists = membershipRows && membershipRows.length > 1; // More than just headers
118+
// Use the checkMemberExists helper to determine if the member exists
119+
const memberExists = checkMemberExists(eid);
120120

121121
// Update the status message if element exists
122122
if (statusElement) {
@@ -186,6 +186,31 @@ export function getPurchasesByEid(eid) {
186186
return purchasesByEid.get(eid.toLowerCase()) || null;
187187
}
188188

189+
/**
190+
* Check if a member with the given EID exists in the loaded data
191+
* @param {string} eid - The EID to check
192+
* @returns {boolean} - True if the member exists
193+
*/
194+
export function checkMemberExists(eid) {
195+
// If no data loaded or no EID provided, return false
196+
if (!membershipRows || !eid) return false;
197+
198+
// Normalize the search EID
199+
const normalizedSearchEid = eid.trim().toLowerCase();
200+
201+
// Check if there's an EID match in the first column
202+
for (let i = 1; i < membershipRows.length; i++) {
203+
if (membershipRows[i].length > 0) {
204+
const rowEid = membershipRows[i][0].trim().toLowerCase();
205+
if (rowEid === normalizedSearchEid) {
206+
return true;
207+
}
208+
}
209+
}
210+
211+
return false;
212+
}
213+
189214
/**
190215
* Check if membership data is loaded
191216
* @returns {boolean} - True if data is loaded
@@ -248,12 +273,17 @@ function initializeModule() {
248273
setTimeout(() => {
249274
loadMembershipData(currentEid).then(success => {
250275
if (success) {
251-
console.log(`Auto-loaded membership data for ${currentEid}`);
276+
// Check if member truly exists by exact EID match
277+
const memberExists = checkMemberExists(currentEid);
278+
279+
console.log(`Auto-loaded membership data for ${currentEid}, member exists: ${memberExists}`);
280+
252281
// Dispatch a custom event that other scripts can listen for
253282
document.dispatchEvent(new CustomEvent('eidDataLoaded', {
254283
detail: {
255284
eid: currentEid,
256-
success: true
285+
success: true,
286+
memberExists: memberExists
257287
}
258288
}));
259289
}

0 commit comments

Comments
 (0)