Support Ticket Details
Ticket Number: ID1710204215758
Date Submitted: 3/12/2024
Ticket Status (open/closed/working): Closed
Ticket Type: Site Technical Issue
P1 - Urgent
Site Version: V3.00
Submitter: Mark Henneberger
Email:
Screenshots Attached:
none
Documents Attached:
none
Why submitted:
Some people are occassionally not included in alumni searches. Examples:
only 1st 8 LL or supply get included
Ryan bergamini never shows up
troubleshoot and fix
Recommended Action:
Did a complete rewrite of the source code to work more similar to the books search function. Should be more robust and easier to troubleshoot while also being much more efficient. New code: sync function search() { const nameInput = $w("#nameSearchQueryInput").value.trim(); const sourceInput = $w("#sourceSearchQueryInput").value.trim(); const toNrInput = $w("#toNrSearchQueryInput").value.trim(); let bresClassInput = $w("#classSearchQueryInput").value.trim().toUpperCase(); console.log("starting search"); // Early error handling for class search without specific source if (sourceInput === "All" && bresClassInput !== "") { $w("#errorMessageText").text = "Class search requires selecting a specific source."; $w("#errorMessageContainer").show(); return; } console.log("confirmed valid search request"); try { let query = wixData.query("Alumni"); console.log("completed baseline query"); // Combining first and last name queries using .or() if name input is provided if (nameInput !== "") { const lastNameQuery = wixData.query("Alumni").contains("last", nameInput); const firstNameQuery = wixData.query("Alumni").contains("first", nameInput); query = lastNameQuery.or(firstNameQuery); } console.log("combined last name and first query's into query "); // Adding source condition if (sourceInput !== "All" && sourceInput !== "") { query = query.eq("source", sourceInput); } console.log("combined source query's into query "); // Adding "toNr" condition if (toNrInput !== "") { const toNrYear = toNrInput.replace(/[^0-9]/g, ''); query = query.contains("toNr", toNrYear); } console.log("combined toNR query's into query "); // Adding "bresClass" condition if (bresClassInput !== "") { let bresClass = bresClassInput.replace(/[^0-9]/g, ''); query = query.contains("bresClass", bresClass); } console.log("combined BRES query's into query "); // Execute the query const results = await query.find(); console.log("executed query.find() "); // Processing and displaying results if (results.items.length > 0) { $w('#alumniListRepeater').data = results.items; $w("#alumniListRepeater").expand(); } else { $w("#noRecordsFoundNotice").show(); console.log("No results found."); $w('#alumniListRepeater').collapse(); } } catch (error) { console.error("Search failed:", error); // Implement additional user feedback for failed search here, if necessary } }
Resolution