MCPcopy Create free account
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

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

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