This commit is contained in:
tmshv committed 2014-11-04 21:50:09 +03:00
1 parent 6909a25e1b
commit 7e30f7f278
20 files changed
+1250 -228

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
const DOCS = require("./documents.json");
exports.docs = DOCS;
exports.doc = getDocByName;
exports.cap = makeCap;
// exports.extra = populateExtra;
function getDocByName(name){
if(name && typeof name == "string"){
for(var i=0; i<DOCS.length; i++){
var doc = DOCS[i];
if(doc.name == name){
return clone(doc);
}
}
return null;
}else if(name && name instanceof Array){
var docs = [];
name.forEach(function(i){
var d = getDocByName(i);
if(d){
docs.push(d);
}
});
return docs;
}else{
return null;
}
}
function clone(obj){
if(obj == null || typeof(obj) != 'object')
return obj;
var temp = obj.constructor(); // changed
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
}
/**
* Capitalize first letter of document name
* Process doc object or array of objects
* @param {Object | Array} doc document object or array of document objects
* @return {[type]} document object or array of document objects with capitalized first letter of document name
*/
function makeCap(doc){
if(doc instanceof Array){
for(var i=0; i<doc.length; i++){
doc[i] = makeCap(doc[i]);
}
}else{
var n = doc.name;
doc.name = n.charAt(0).toUpperCase() + n.substring(1);
}
return doc;
}
// function populateExtra(doc, extra){
// if(!doc.extra) doc.extra = {};
// for(var i in extra){
// if(!doc.extra[i]) doc.extra[i] = [];
// doc.extra[i] = doc.extra[i].concat(extra[i]);
// }
// return doc;
// }
+36 -33
View File
@@ -6,35 +6,38 @@
"preview": "/img/preview/statue-2013.png",
"download": "http://static.shburg.org/art/docs/hudozhka_statue-2013.pdf",
"url": [
"http://static.shburg.org/art/docs/hudozhka_statue-2013-1.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-2.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-3.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-4.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-5.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-6.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-7.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-8.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-9.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-10.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-11.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-12.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-13.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-14.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-15.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-16.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-17.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-18.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-19.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-20.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-21.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-22.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-23.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-24.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-25.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-26.page",
"http://static.shburg.org/art/docs/hudozhka_statue-2013-27.page"
"/f/hudozhka_statue-2013-1.page",
"/f/hudozhka_statue-2013-2.page",
"/f/hudozhka_statue-2013-3.page",
"/f/hudozhka_statue-2013-4.page",
"/f/hudozhka_statue-2013-5.page",
"/f/hudozhka_statue-2013-6.page",
"/f/hudozhka_statue-2013-7.page",
"/f/hudozhka_statue-2013-8.page",
"/f/hudozhka_statue-2013-9.page",
"/f/hudozhka_statue-2013-10.page",
"/f/hudozhka_statue-2013-11.page",
"/f/hudozhka_statue-2013-12.page",
"/f/hudozhka_statue-2013-13.page",
"/f/hudozhka_statue-2013-14.page",
"/f/hudozhka_statue-2013-15.page",
"/f/hudozhka_statue-2013-16.page",
"/f/hudozhka_statue-2013-17.page",
"/f/hudozhka_statue-2013-18.page",
"/f/hudozhka_statue-2013-19.page",
"/f/hudozhka_statue-2013-20.page",
"/f/hudozhka_statue-2013-21.page",
"/f/hudozhka_statue-2013-22.page",
"/f/hudozhka_statue-2013-23.page",
"/f/hudozhka_statue-2013-24.page",
"/f/hudozhka_statue-2013-25.page",
"/f/hudozhka_statue-2013-26.page",
"/f/hudozhka_statue-2013-27.page"
],
"view":"frame"
"extra": {
"style": ["http://static.shburg.org/art/docs/preview/hudozhka_statue-2013.css"]
},
"viewer": "default"
},
{
"name": "edu-license",
@@ -46,7 +49,7 @@
"http://static.shburg.org/art/docs/hudozhka_license_edu_back.jpg",
"http://static.shburg.org/art/docs/hudozhka_license_edu_attachment.jpg"
],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "gov-certificate",
@@ -54,7 +57,7 @@
"path": "/document/gov-certificate",
"preview": "/img/preview/certificate_gov.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_certificate_gov.jpg"],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "VAT",
@@ -62,7 +65,7 @@
"path": "/document/VAT",
"preview": "/img/preview/vatin.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_vatin.jpg"],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "EGRYL1",
@@ -70,7 +73,7 @@
"path": "/document/EGRYL1",
"preview": "/img/preview/certificate_egryl1.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_certificate_egryl1.jpg"],
"view":"page"
"viewer": "img-sheet"
},
{
"name": "EGRYL2",
@@ -78,6 +81,6 @@
"path": "/document/EGRYL2",
"preview": "/img/preview/certificate_egryl2.png",
"url": ["http://static.shburg.org/art/docs/hudozhka_certificate_egryl2.jpg"],
"view":"page"
"viewer": "img-sheet"
}
]
+438
View File
@@ -0,0 +1,438 @@
[
{
"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": ".",
"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": "Тимашева А.С.",
"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": "Тимашева А.С.",
"time": [
"13:00 – 13:45",
"13:55 – 14:40"
]
}
},
{
"name": "2-3",
"monday": {
"lesson": "painting",
"teacher": " ",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"thursday": {
"lesson": "cg",
"teacher": "nv-andreeva",
"time": [
"15:00 – 15:45",
"15:55 – 16:40"
]
},
"friday": {
"lesson": "composition",
"teacher": "Тимашева А.С.",
"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": ".",
"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": "Тимашева А.С.",
"time": [
"17:00 – 17:45",
"17:55 – 18:40"
]
},
"saturday": {
"lesson": "drawing",
"teacher": "Тимашева А.С.",
"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": ".",
"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",
""
]
}
}
]
+61
View File
@@ -0,0 +1,61 @@
var pop = require("../utils/populate").pop;
var populate = require("../utils/populate").populate;
const SCHEDULE = require("./schedule-2014-early.json");
const WEEK = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
module.exports = schedule;
function schedule(pops){
var days = function(group){
var result = [];
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 = [];
SCHEDULE.forEach(function(group){
result.push({
name: group.name,
days: days(group),
time: mondayTime(group)
});
});
return result;
}