code cleaning up; - pages/; -routers/;

This commit is contained in:
tmshv committed 2015-03-01 04:49:49 +03:00
1 parent 6e4749476a
commit 4d0c64bb93
23 files changed
+62 -1339

No files matched your search

-402
View File
@@ -1,402 +0,0 @@
[
{
"name": "1",
"monday": {
"lesson": "composition",
"teacher": "as-timasheva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"10:00 10:45",
"10:55 11:40"
]
}
},
{
"name": "2",
"tuesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"friday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"saturday": {
"lesson": "composition",
"teacher": "as-timasheva",
"time": [
"12:00 12:45",
"12:55 13:40"
]
}
},
{
"name": "3",
"thursday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"friday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "composition",
"teacher": "as-timasheva",
"time": [
"10:00 10:45",
"10:55 11:40"
]
}
},
{
"name": "4",
"monday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"thursday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "5",
"monday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
}
},
{
"name": "6",
"wednesday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"thursday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"friday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "7",
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45"
]
},
"thursday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"friday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "cg",
"teacher": "rk-timashev",
"time": [
"10:00 10:45",
"10:55 11:40"
]
}
},
{
"name": "8",
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45"
]
},
"thursday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"friday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"saturday": {
"lesson": "cg",
"teacher": "rk-timashev",
"time": [
"12:00 12:45",
"12:55 13:40"
]
}
},
{
"name": "9",
"monday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 18:45"
]
},
"friday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "10",
"monday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 18:45"
]
},
"friday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
}
},
{
"name": "11",
"monday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"wednesday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45"
]
},
"friday": {
"lesson": "composition",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "12",
"monday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45"
]
},
"friday": {
"lesson": "composition",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
}
},
{
"name": "13",
"tuesday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 18:45"
]
},
"friday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
}
}
]
-438
View File
@@ -1,438 +0,0 @@
[
{
"name": "1-1",
"tuesday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"thursday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"11:00 11:45",
"11:55 12:40"
]
}
},
{
"name": "1-2",
"tuesday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"13:00 13:45",
"13:55 14:40"
]
}
},
{
"name": "1-3",
"monday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"friday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "sculpting",
"teacher": "in-vturina",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "2-1",
"monday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "composition",
"teacher": "as-timasheva",
"time": [
"11:00 11:45",
"11:55 12:40"
]
}
},
{
"name": "2-2",
"monday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"saturday": {
"lesson": "composition",
"teacher": "as-timasheva",
"time": [
"13:00 13:45",
"13:55 14:40"
]
}
},
{
"name": "2-3",
"monday": {
"lesson": "painting",
"teacher": "od-gogoleva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"friday": {
"lesson": "composition",
"teacher": "as-timasheva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "3-1",
"monday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"tuesday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45",
""
]
},
"thursday": {
"lesson": "painting",
"teacher": "sa-latipova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"saturday": {
"lesson": "cg",
"teacher": "rk-timashev",
"time": [
"13:00 13:45",
"13:55 14:40"
]
}
},
{
"name": "3-2",
"monday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"tuesday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45",
""
]
},
"thursday": {
"lesson": "painting",
"teacher": "sa-latipova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"saturday": {
"lesson": "cg",
"teacher": "rk-timashev",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "3-3",
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45",
""
]
},
"thursday": {
"lesson": "composition",
"teacher": "nv-andreeva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"friday": {
"lesson": "painting",
"teacher": "as-timasheva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"saturday": {
"lesson": "drawing",
"teacher": "as-timasheva",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "4-1",
"monday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 18:45",
""
]
},
"friday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"15:00 15:45",
"15:55 16:40"
]
}
},
{
"name": "4-2",
"monday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"tuesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"wednesday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 18:45",
""
]
},
"friday": {
"lesson": "drawing",
"teacher": "sa-latipova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
}
},
{
"name": "5-1",
"monday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"15:00 15:45",
"15:55 16:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45",
""
]
}
},
{
"name": "5-2",
"monday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"tuesday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"17:00 17:45",
""
]
}
},
{
"name": "6-1",
"wednesday": {
"lesson": "painting",
"teacher": "va-sarzhin",
"time": [
"17:00 17:45",
"17:55 18:40"
]
},
"thursday": {
"lesson": "drawing",
"teacher": "mg-timasheva",
"time": [
"16:00 17:45",
""
]
},
"friday": {
"lesson": "composition",
"teacher": "vv-voronova",
"time": [
"17:00 17:45",
"17:55 18:40"
]
}
},
{
"thursday": {
"lesson": "history",
"teacher": "my-valkova",
"time": [
"18:00 18:45",
""
]
}
}
]
+52 -67
View File
@@ -1,77 +1,62 @@
var pop = require("../utils/populate").pop;
const WEEK = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
const SCHEDULES = {
"2014-early": require("./schedule-2014-early.json"),
"2014-late": require("./schedule-2014-late.json")
module.exports = {
populate: populateSchedule
};
function schedule (year, name, pops){
var s = SCHEDULES[year + "-" + name];
return populateSchedule(s, pops);
}
function populateSchedule(s, pops) {
var days = function (group) {
var result = [];
schedule.populate = populateSchedule;
WEEK.forEach(function (i) {
var lesson = group[i];
if (lesson) {
result.push(
pop(lesson)
.populate(time())
.populate(pops)
.result()
)
} else {
result.push(null);
}
});
return result;
};
module.exports = schedule;
//var s = require(
// [year, name].reduce(function (r, v, i) {
// var n = "{i}".replace("i", i);
// return r.replace(n, v);
// }, "./schedule-{0}-{1}.json")
//);
var time = function () {
return function (lesson) {
for (var i = 0; i < lesson.time.length; i++) {
lesson.time[i] = lesson.time[i].replace(" ", "—");
}
return lesson;
}
};
function populateSchedule(s, pops){
var days = function (group) {
var result = [];
var mondayTime = function (group) {
var day;
for (var i = 0; i < WEEK.length; i++) {
if (group[WEEK[i]]) {
day = WEEK[i];
break;
}
}
if (day) {
return group[day].time[0].substr(0, 5);
} else {
return "00:00"
}
};
WEEK.forEach(function (i) {
var lesson = group[i];
if (lesson) {
result.push(
pop(lesson)
.populate(time())
.populate(pops)
.result()
)
} else {
result.push(null);
}
});
return result;
};
var time = function () {
return function (lesson) {
for (var i = 0; i < lesson.time.length; i++) {
lesson.time[i] = lesson.time[i].replace(" ", "—");
}
return lesson;
}
};
var mondayTime = function (group) {
var day;
for (var i = 0; i < WEEK.length; i++) {
if (group[WEEK[i]]) {
day = WEEK[i];
break;
}
}
if (day) {
return group[day].time[0].substr(0, 5);
} else {
return "00:00"
}
};
var result = [];
s.forEach(function (group) {
result.push({
name: group.name,
days: days(group),
time: mondayTime(group)
});
});
return result;
var result = [];
s.forEach(function (group) {
result.push({
name: group.name,
days: days(group),
time: mondayTime(group)
});
});
return result;
}