Calcolo Hours

This commit is contained in:
Paolo Arena
2021-02-11 02:20:35 +01:00
parent 686d6bf97a
commit 88ae9af12c
12 changed files with 335 additions and 33 deletions

View File

@@ -597,7 +597,7 @@ module.exports = {
allfieldTodo: function () {
return ['userId', 'pos', 'category', 'descr', 'priority', 'statustodo', 'assignedToUsers', 'created_at', 'groupId', 'modify_at',
'completed_at', 'expiring_at', 'enableExpiring', 'progress', 'modified', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'themecolor', 'themebgcolor']
'completed_at', 'expiring_at', 'enableExpiring', 'progress', 'modified', 'phase', 'assigned_to_userId', 'assignedToUsers', 'hoursplanned', 'hoursworked', 'start_date', 'themecolor', 'themebgcolor']
},
allfieldMyEvent: function () {
@@ -1039,6 +1039,26 @@ module.exports = {
filtriadded.push({
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
});
// Hours
if (params.filterand.includes(shared_consts.FILTER_HOURS_ALL))
filtriadded.push(
{
idapp,
todoId: params.codeId,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
);
else if (params.filterand.includes(shared_consts.FILTER_HOURS_MYLIST))
filtriadded.push(
{
idapp,
userId: ObjectID(params.userId),
todoId: params.codeId,
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }]
}
);
if (params.filterand.includes(shared_consts.FILTER_NASCOSTI))
filtriadded.push({
deleted: { $exists: true, $eq: true }
@@ -1074,6 +1094,23 @@ module.exports = {
if (numrowend < 0)
numrowend = 1;
if (params.lk_tab) {
query.push(
{
$lookup: {
from: params.lk_tab,
localField: params.lk_LF, // field in my collection
foreignField: params.lk_FF, // field in the 'from' collection
as: params.lk_as
}
},
{
$replaceRoot: { newRoot: { $mergeObjects: [{ $arrayElemAt: ['$' + params.lk_as, 0] }, "$$ROOT"] } }
},
{ $project: params.lk_proj }
);
}
query.push(
{
$group: {