MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / findLatestYearForApplicant

Function findLatestYearForApplicant

src/Data/UserData.js:265–270  ·  view source on GitHub ↗

* Find the latest year with data for a given applicant * @param {string[]} applicantIDs - Applicant IDs in the form "displayName@year" * @returns {Promise } - Latest year or null if no data found

(applicantIDs = [])

Source from the content-addressed store, hash-verified

263 * @returns {Promise<number|null>} - Latest year or null if no data found
264 */
265function findLatestYearForApplicant(applicantIDs = []) {
266 const validYears = applicantIDs
267 .map(id => Number.parseInt(id.split('@')[1], 10))
268 .filter(Number.isFinite);
269 return validYears.length > 0 ? Math.max(...validYears) : null;
270}
271
272function metadataWithLatestYear(metadata) {
273 const result = metadata ?? {};

Callers 1

metadataWithLatestYearFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected