Reportistica Ore 2

This commit is contained in:
Paolo Arena
2021-02-24 04:48:31 +01:00
parent 14a3292da2
commit 39c08afb95
13 changed files with 427 additions and 56 deletions

View File

@@ -483,7 +483,7 @@ module.exports = {
LANGADMIN: 'it',
AYNI: '7',
SIP: '9',
CNM: '10',
HELP_CHAT: 'https://t.me/joinchat/AL2qKE80rxDkgbeMGO-0bw',
TYPECONF_ZOOM: 'zoom',
@@ -633,7 +633,7 @@ module.exports = {
allfieldProject: function () {
return ['idapp', 'userId', 'respUsername', 'viceRespUsername', 'pos', 'typeproj', 'id_main_project', 'id_parent', 'descr', 'longdescr', 'groupId', 'hoursplanned', 'hoursleft', 'themecolor', 'themebgcolor', 'hoursworked', 'priority', 'statusproj', 'created_at', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'progressCalc', 'modified', 'live_url', 'test_url', 'begin_development', 'begin_test', 'totalphases', 'actualphase', 'hoursweeky_plannedtowork', 'endwork_estimate'
, 'privacyread', 'privacywrite']
, 'privacyread', 'privacywrite', 'tipovisu']
},
allfieldBooking: function () {
@@ -1074,7 +1074,7 @@ module.exports = {
filtriadded.push(
{
idapp,
userId: ObjectID(params.userId),
userId: params.userId,
todoId: params.codeId,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
@@ -1157,26 +1157,18 @@ module.exports = {
},
executeQueryTable(mythistable, idapp, params) {
async executeQueryTable(mythistable, idapp, params) {
let query = this.getQueryTable(idapp, params);
return mythistable
.aggregate(query)
.then(([ris]) => {
if (ris) {
// console.table(ris.rows);
// console.log('ROW ', ris.count);
return ({ count: ris.count, rows: ris.rows })
} else {
return ({ count: 0, rows: [] })
}
})
.catch(err => {
console.error(err);
return {
count: 0, rows: []
}
});
const [ris] = await mythistable.aggregate(query);
if (ris) {
// console.table(ris.rows);
// console.log('ROW ', ris.count);
return ({ count: ris.count, rows: ris.rows })
} else {
return ({ count: 0, rows: [] })
}
},
async DuplicateAllRecords(mythistable, idapporig, idappdest) {
@@ -1369,6 +1361,16 @@ module.exports = {
}
},
isSunday(mydate) {
const dayOfWeek = new Date(mydate).getDay()
return dayOfWeek === 0
},
isMonday(mydate) {
const dayOfWeek = new Date(mydate).getDay()
return dayOfWeek === 1
},
getWeekDayByLang(date, lang) {
return this.getWeekDayByLangByNumCar(date, lang, 3)
},
@@ -1406,6 +1408,15 @@ module.exports = {
}
},
getstrDateYYYY_MM_DD(mydate) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
return mydate.getFullYear() + '-' + this.appendLeadingZeroes(mydate.getMonth() + 1) + '-' + this.appendLeadingZeroes(mydate.getDate())
} else {
return '';
}
},
getstrDateLong(mydate, lang) {
if (mydate) {
// console.log('getstrDate', mytimestamp)
@@ -1886,4 +1897,14 @@ module.exports = {
return { query, order }
},
dateToEpoch(thedate) {
const time = new Date(thedate).getTime();
return time - (time % 86400000);
},
dateToEpochStr(thedate) {
const time = new Date(thedate).getTime();
return new Date(time - (time % 86400000));
}
};