added themecolor and themebgcolor to todos and projects

This commit is contained in:
Paolo Arena
2019-04-29 23:47:48 +02:00
parent 4ed5a3d350
commit 1f9f5b44bd
3 changed files with 55 additions and 32 deletions

View File

@@ -89,6 +89,14 @@ var ProjectSchema = new mongoose.Schema({
type: Number, type: Number,
default: 0 default: 0
}, },
themecolor: {
type: String,
default: ''
},
themebgcolor: {
type: String,
default: ''
},
progressCalc: { progressCalc: {
type: Number, type: Number,
default: 0 default: 0

View File

@@ -71,6 +71,13 @@ var TodoSchema = new mongoose.Schema({
hoursworked: { hoursworked: {
type: Number, type: Number,
}, },
themecolor: {
type: String,
},
themebgcolor: {
type: String,
default: '',
},
modified: { modified: {
type: Boolean, type: Boolean,
}, },
@@ -375,47 +382,55 @@ TodoSchema.statics.calculateTreeTodo = async function (actualphase, userId, idpr
.then(() => { .then(() => {
// console.log('objdata', objdata); // console.log('objdata', objdata);
// 2) Calculate the Todos of this project // 2) Calculate the Todos of this project
return Todo.calculateTodoHoursAndProgress(userId, idproj, myrecproj.actualphase); if (!!myrecproj)
return Todo.calculateTodoHoursAndProgress(userId, idproj, myrecproj.actualphase);
else
return null
}) })
.then((objdatatodos) => { .then((objdatatodos) => {
if (myrecproj.actualphase === actualphase) { if (!!objdatatodos) {
// console.log('objdatatodos', objdatatodos); if (!!myrecproj) {
objdata.addDataTodo(objdatatodos); if (myrecproj.actualphase === actualphase) {
// console.log('objdatatodos', objdatatodos);
objdata.addDataTodo(objdatatodos);
// End Calculate // End Calculate
objdata.endDataCalc(); objdata.endDataCalc();
// Update into the DB: // Update into the DB:
return Project.updateCalc(userId, idproj, objdata, null) return Project.updateCalc(userId, idproj, objdata, null)
.then((ris) => { .then((ris) => {
if (ris) if (ris)
return objdata.getData(); return objdata.getData();
else else
return null; return null;
}); });
} else { }
return null; }
} }
return null;
}) })
.then((ris) => { .then((ris) => {
if (calcalsoUpper) { if (calcalsoUpper) {
if (!!myrecproj.id_parent) { if (!!myrecproj) {
// Calculate also the upper Projects ! if (!!myrecproj.id_parent) {
return new Promise((resolve, reject) => { // Calculate also the upper Projects !
Todo.calculateTreeTodo(actualphase, userId, myrecproj.id_parent, true, masterproj, false); return new Promise((resolve, reject) => {
resolve(ris) Todo.calculateTreeTodo(actualphase, userId, myrecproj.id_parent, true, masterproj, false);
}); resolve(ris)
} else { });
return new Promise((resolve, reject) => { } else {
resolve() return new Promise((resolve, reject) => {
}); resolve()
});
}
} }
} else {
return new Promise((resolve, reject) => {
resolve()
});
} }
return new Promise((resolve, reject) => {
resolve()
});
}) })
}; };

View File

@@ -56,7 +56,7 @@ module.exports = {
allfieldTodo: function () { allfieldTodo: function () {
return ['userId', 'pos', 'category', 'descr', 'priority', 'statustodo', 'created_at', 'modify_at', return ['userId', 'pos', 'category', 'descr', 'priority', 'statustodo', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progress', 'modified', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date'] 'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progress', 'modified', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'themecolor', 'themebgcolor']
}, },
allfieldTodoWithId: function () { allfieldTodoWithId: function () {
@@ -65,7 +65,7 @@ module.exports = {
// #TODO Projects++ Add fields ... // #TODO Projects++ Add fields ...
allfieldProject: function () { allfieldProject: function () {
return ['userId', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'hoursplanned', 'hoursleft', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at', return ['userId', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'hoursplanned', 'hoursleft', 'themecolor', 'themebgcolor', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate' 'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
, 'privacyread', 'privacywrite'] , 'privacyread', 'privacywrite']
}, },