Vertical lines appear only for executed resources
Labels for daily graph do not include the year in the x-axis.
This commit is contained in:
Juan Salvador Pérez García
2018-07-12 11:02:34 +02:00
parent 256c0d72a5
commit e7b3965991
2 changed files with 23 additions and 3 deletions

View File

@@ -141,9 +141,8 @@
}
ProposalGraph.prototype.draw = function(data) {
this.xColumnValues = this.xColumnValues.sort();
this.xColumnValues.unshift('x');
this.formatXColumnValues();
this.chart = c3.generate({
bindto: '#' + this.targetId,
data: {
@@ -187,6 +186,25 @@
});
};
ProposalGraph.prototype.formatXColumnValues = function () {
var i, l, parts;
this.xColumnValues = this.xColumnValues.sort();
if (this.isDailyGrouped()) {
for (i = 0, l = this.xColumnValues.length; i < l; i += 1) {
parts = this.xColumnValues[i].match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
this.xColumnValues[i] = parts[2] + "/" + parts[3];
}
}
this.xColumnValues.unshift('x');
}
ProposalGraph.prototype.isDailyGrouped = function() {
return this.groupBy === undefined || this.groupBy === '' || this.groupBy === null
};
$(document).ready(function () {
$('[data-proposal-graph-url]').each(function () {
var graph = new ProposalGraph($(this).data('proposal-graph-url'));

View File

@@ -37,8 +37,10 @@ class ProposalAchievementsQuery
def achievements
ProposalExecutedDashboardAction
.joins(:proposal_dashboard_action)
.includes(:proposal_dashboard_action)
.where(proposal: proposal, executed_at: start_date.beginning_of_day..end_date.end_of_day)
.where(proposal_dashboard_actions: { action_type: 1 })
.order(executed_at: :asc)
end