MCPcopy Index your code
hub / github.com/OpenSIST/OpenSIST.github.io / getProgram

Function getProgram

src/Data/ProgramData.js:105–129  ·  view source on GitHub ↗
(programId, isRefresh = false, options = {})

Source from the content-addressed store, hash-verified

103}
104
105export async function getProgram(programId, isRefresh = false, options = {}) {
106 /*
107 * Get the program (without description) from the server or local storage by programId
108 * @param programId [String]: programId
109 * @param isRefresh [Boolean]: whether to refresh the data
110 * @return: program (without description)
111 */
112 const programs = await getPrograms(isRefresh, {}, "cs_rank", options);
113 const univName = programId.split('@')[1]
114 if (!programs[univName]) {
115 throw new Response("", {
116 status: 404,
117 statusText: "Program not found",
118 }
119 );
120 }
121 const program = programs[univName].find(currentProgram => currentProgram.ProgramID === programId);
122 if (!program) {
123 throw new Response("", {
124 status: 404,
125 statusText: "Program not found",
126 });
127 }
128 return program;
129}
130
131export async function getProgramDesc(programId, isRefresh = false, {priority = FOREGROUND_PRIORITY} = {}) {
132 /*

Callers 5

addModifyRecordFunction · 0.90
getRecordByProgramFunction · 0.90
deleteRecordFunction · 0.90
getProgramContentFunction · 0.85
addModifyProgramFunction · 0.85

Calls 1

getProgramsFunction · 0.85

Tested by

no test coverage detected