Commit d9065770 authored by thomas craipeau's avatar thomas craipeau
Browse files

fix commentaire date et ecart pour ?old

parent 9b326395
......@@ -31,7 +31,11 @@ Comments.helpers({
if (Meteor.isClient) {
Comments.helpers({
dateComments() {
return moment.unix(this.created).format('L LT');
return moment.unix(this.created).format('YYYY-MM-DD HH:mm');
},
dateCommentsLocale() {
const inputUnix = moment.unix(this.created);
return moment(inputUnix).format('L LT');
},
textMentions() {
if (this.text) {
......
......@@ -2174,7 +2174,10 @@ indexMax:20 */
insert.parentId = '';
}
insert.text = doc.text;
const created = Math.floor(new Date().getTime() / 1000);
const formatDate = moment(new Date()).format();
const inputUnix = moment(formatDate).unix();
const created = inputUnix;
insert.created = created;
insert.author = this.userId;
insert.collection = 'comments';
......
......@@ -312,25 +312,27 @@
<template name="actionsMaintenance">
<div class="item item-divider">{{{__ "Actions still to be done which have more than"}}}</div>
{{> actionsMaintenanceItem month=18 color="assertive" icon="fa fa-warning"}}
{{> actionsMaintenanceItem month=12 color="assertive" icon="fa fa-warning"}}
{{> actionsMaintenanceItem month=6 color="energized" icon="fa fa-warning"}}
{{> actionsMaintenanceItem monthStart=18 monthEnd=12 color="assertive" icon="fa fa-warning"}}
{{> actionsMaintenanceItem monthStart=12 monthEnd=6 color="assertive" icon="fa fa-warning"}}
{{> actionsMaintenanceItem monthStart=6 monthEnd=null color="energized" icon="fa fa-warning"}}
<div class="item item-divider">{{{__ "Actions still to be done and without a contributor that have more than"}}}</div>
{{> actionsMaintenanceItem month=18 color="assertive" icon="fa fa-warning" contributor=false}}
{{> actionsMaintenanceItem month=12 color="assertive" icon="fa fa-warning" contributor=false}}
{{> actionsMaintenanceItem month=6 color="energized" icon="fa fa-warning" contributor=false}}
{{> actionsMaintenanceItem monthStart=18 monthEnd=12 color="assertive" icon="fa fa-warning" contributor=false}}
{{> actionsMaintenanceItem monthStart=12 monthEnd=6 color="assertive" icon="fa fa-warning" contributor=false}}
{{> actionsMaintenanceItem monthStart=6 monthEnd=null color="energized" icon="fa fa-warning" contributor=false}}
</template>
<template name="actionsMaintenanceItem">
<div class="item item-icon-left {{color}} {{event}}"><i class="icon {{icon}}"></i>{{__ "number_month" count=month}}
<span class="badge badge-{{color}}">{{maintenanceChiffreCount month contributor}}</span>
<div class="item item-icon-left {{color}} {{event}}"><i class="icon {{icon}}"></i>{{#if monthEnd}}
{{__ "number_month" count=monthStart}} - {{__ "number_month" count=monthEnd}}
{{else}} {{__ "number_month" count=monthStart}} {{/if}}
<span class="badge badge-{{color}}">{{maintenanceChiffreStartEndCount monthStart monthEnd contributor}}</span>
</div>
{{#unless noList}}
{{#if maintenanceChiffreCount month}}
{{#scrollBlock title=(__ "Actions") count=(maintenanceChiffreCount month contributor) activeSearch=false}}
{{#each action in maintenanceChiffre month contributor}}
{{#if maintenanceChiffreStartEndCount monthStart monthEnd contributor}}
{{#scrollBlock title=(__ "Actions") count=(maintenanceChiffreStartEndCount monthStart monthEnd contributor) activeSearch=false}}
{{#each action in maintenanceChiffreStartEnd monthStart monthEnd contributor}}
{{> itemInputAction action=action}}
{{/each}}
{{/scrollBlock}}
......
......@@ -502,4 +502,32 @@ Template.actionsMaintenanceItem.helpers({
sort: { created: -1 },
});
},
maintenanceChiffreStartEndCount(monthStart, monthEnd, contributor = true) {
const inputUnixStart = dateUnixSubtract(monthStart);
const inputUnixEnd = monthEnd ? dateUnixSubtract(monthEnd) : new Date().getTime();
const query = {};
query.status = 'todo';
query.created = { $exists: true, $lt: inputUnixEnd, $gt: inputUnixStart };
// sans contributeur
if (!contributor) {
query['links.contributors'] = { $exists: false };
}
// console.log('count action plus de 18 mois', Actions.find(query).count());
return Actions.find(query).count();
},
maintenanceChiffreStartEnd(monthStart, monthEnd, contributor = true) {
const inputUnixStart = dateUnixSubtract(monthStart);
const inputUnixEnd = monthEnd ? dateUnixSubtract(monthEnd) : new Date().getTime();
const query = {};
query.status = 'todo';
query.created = { $exists: true, $lt: inputUnixEnd, $gt: inputUnixStart };
// sans contributeur
if (!contributor) {
query['links.contributors'] = { $exists: false };
}
// console.log('count action plus de 18 mois', Actions.find(query).count());
return Actions.find(query, {
sort: { created: -1 },
});
},
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment