++ hoursweeky_plannedtowork, endwork_estimate, totalphases , actualphase

This commit is contained in:
Paolo Arena
2019-04-07 21:24:27 +02:00
parent 1856818d3a
commit 7b444bc561
5 changed files with 163 additions and 88 deletions

View File

@@ -27,14 +27,6 @@ var ProjectSchema = new mongoose.Schema({
longdescr: {
type: String,
},
hoursplanned: {
type: Number,
default: 0
},
hoursworked: {
type: Number,
default: 0
},
id_parent: {
type: String,
},
@@ -64,10 +56,6 @@ var ProjectSchema = new mongoose.Schema({
id_prev: {
type: String,
},
progressCalc: {
type: Number,
default: 0
},
modified: {
type: Boolean,
},
@@ -77,12 +65,39 @@ var ProjectSchema = new mongoose.Schema({
test_url: {
type: String,
},
totalphases: {
type: Number,
default: 1
},
actualphase: {
type: Number,
default: 1
},
hoursplanned: {
type: Number,
default: 0
},
hoursworked: {
type: Number,
default: 0
},
progressCalc: {
type: Number,
default: 0
},
begin_development: {
type: Date,
},
begin_test: {
type: Date,
},
hoursweeky_plannedtowork: {
type: Number,
default: 0
},
endwork_estimate: {
type: Date
}
});
@@ -176,7 +191,6 @@ ProjectSchema.statics.getAllProjects = async function (userId) {
ProjectSchema.statics.updateCalc = async function (userId, idproj, objdatacalc, recIn) {
return new Promise((resolve, reject) => {
if (!!recIn) {
return resolve(recIn);
@@ -185,21 +199,22 @@ ProjectSchema.statics.updateCalc = async function (userId, idproj, objdatacalc,
}
}).then((myproj) => {
if (!!myproj) {
// console.log('myproj', myproj);
console.log('objdatacalc progressCalc', objdatacalc.mydata.progressCalc);
objdatacalc.setValuesToRecord(myproj);
console.log('updateCalc', myproj._id, objdatacalc);
// console.log('updateCalc', myproj._id, myproj.progressCalc);
myproj.save()
return myproj.save()
.then(() => {
// console.log('salvato proj!');
return true;
})
.catch(err => {
console.log("Error updateCalc", err.message);
});
}
return true;
return false;
}).catch(e => {
console.log('Error: ', e);
return false;