Files
hudozka/models/course.js
T
tmshv 8784043f1d = schedule page added;
+ clients dir for browser code;
+ some models (course);
= other (main style, etc);
2014-03-18 23:16:45 +04:00

21 lines
383 B
JavaScript

const COURSES = require("./courses.json");
exports.courses = COURSES;
exports.course = getCourseByID;
exports.name = getCourseNameByID;
function getCourseByID(id){
for(var i=0; i<COURSES.length; i++){
var p = COURSES[i];
if(p.id == id){
return p;
}
}
return null;
}
function getCourseNameByID(id){
var p = getCourseByID(id);
if(p) return p.name;
else return null;
}