diff --git a/src/views/admin/js/store/modules/report/index.js b/src/views/admin/js/store/modules/report/index.js
index af9b92809..7f4ba3014 100644
--- a/src/views/admin/js/store/modules/report/index.js
+++ b/src/views/admin/js/store/modules/report/index.js
@@ -142,6 +142,7 @@ const state = {
dataLabels: {
enabled: false
},
+ colors: [ '#298596' ],
title: {
text: ''
},
diff --git a/src/views/reports/pages/reports-list.vue b/src/views/reports/pages/reports-list.vue
index 0db8f8266..238ebbc3d 100644
--- a/src/views/reports/pages/reports-list.vue
+++ b/src/views/reports/pages/reports-list.vue
@@ -143,7 +143,7 @@
style="min-height=740px"
class="skeleton postbox" />
-
-
+ -->
@@ -316,8 +316,8 @@ export default {
let metadataTypeLabels = [];
for (const metadataType in this.metadata.totals.metadata_per_type) {
- metadataTypeValues.push(this.metadata.totals.metadata_per_type[metadataType].count);
- metadataTypeLabels.push(this.metadata.totals.metadata_per_type[metadataType].name);
+ metadataTypeValues.push(this.metadata.totals.metadata_per_type[metadataType].count ? this.metadata.totals.metadata_per_type[metadataType].count : 0);
+ metadataTypeLabels.push(this.metadata.totals.metadata_per_type[metadataType].name ? this.metadata.totals.metadata_per_type[metadataType].name : '');
}
this.metadataTypeChartSeries = metadataTypeValues;
@@ -613,7 +613,7 @@ export default {
(val,index) => {
return {
name: (index + 1),
- data: new Array(53).fill({x: '', y: 0})
+ data: new Array(53).fill({ x: '', y: 0 })
}
}
);
@@ -629,55 +629,54 @@ export default {
for (let line = 0; line < 7; line++) {
// If there are no more days with activities, get outta here
- if (dayWithActivityIndex >= daysWithActivities.length)
- break;
+ if (dayWithActivityIndex < daysWithActivities.length - 1) {
+
+ // We should only begin inserting days from firstDayOfTheWeekWithActivity
+ if (column == 0 && line < firstDayOfTheWeekWithActivity - 1) {
+ continue;
- // We should only begin inserting days from firstDayOfTheWeekWithActivity
- if (column == 0 && line < firstDayOfTheWeekWithActivity - 1) {
- continue;
-
- // On the first day, we don't need to calculate distances, just set the value and save the date
- } else if (column == 0 && line == firstDayOfTheWeekWithActivity - 1) {
- everyDayOfTheYear[line].data[column] = {
- x: '',
- y: parseInt(daysWithActivities[dayWithActivityIndex].total)
- };
-
- const lastDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].year, daysWithActivities[dayWithActivityIndex].month - 1, daysWithActivities[dayWithActivityIndex].day);
- dayWithActivityIndex++;
-
- const nextDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].year, daysWithActivities[dayWithActivityIndex].month - 1, daysWithActivities[dayWithActivityIndex].day);
-
- daysToSkip = Math.floor( (nextDayWithActivity - lastDayWithActivity) / (1000 * 60 * 60 * 24) );
- } else {
- daysToSkip--;
-
- // If we don't have more days to skip, time to update values
- if ( daysToSkip <= 0) {
+ // On the first day, we don't need to calculate distances, just set the value and save the date
+ } else if (column == 0 && line == firstDayOfTheWeekWithActivity - 1) {
everyDayOfTheYear[line].data[column] = {
x: '',
y: parseInt(daysWithActivities[dayWithActivityIndex].total)
};
- const lastDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].year, daysWithActivities[dayWithActivityIndex].month - 1, daysWithActivities[dayWithActivityIndex].day);
+ const lastDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].date);
dayWithActivityIndex++;
- const nextDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].year, daysWithActivities[dayWithActivityIndex].month - 1, daysWithActivities[dayWithActivityIndex].day);
+ const nextDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].date);
daysToSkip = Math.floor( (nextDayWithActivity - lastDayWithActivity) / (1000 * 60 * 60 * 24) );
- console.log(daysToSkip, nextDayWithActivity, lastDayWithActivity);
+ } else {
+ daysToSkip--;
+
+ // If we don't have more days to skip, time to update values
+ if ( daysToSkip <= 0) {
+ everyDayOfTheYear[line].data[column] = {
+ x: '',
+ y: parseInt(daysWithActivities[dayWithActivityIndex].total)
+ };
+
+ const lastDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].date);
+ dayWithActivityIndex++;
+
+ const nextDayWithActivity = new Date(daysWithActivities[dayWithActivityIndex].date);
+
+ daysToSkip = Math.floor( (nextDayWithActivity - lastDayWithActivity) / (1000 * 60 * 60 * 24) );
+ console.log(lastDayWithActivity);
+ }
}
}
}
}
-
- this.activitiesChartSeries = everyDayOfTheYear();
+ this.activitiesChartSeries = everyDayOfTheYear;
this.activitiesChartOptions = {
...this.heatMapChartOptions,
title: {
text: this.$i18n.get('label_activities_last_year')
},
- }
+ };
} else {
this.activitiesChartSeries = [];
this.activitiesChartOptions = {
diff --git a/src/views/tainacan-admin-i18n.php b/src/views/tainacan-admin-i18n.php
index 1a6daf0b3..3a95fd388 100644
--- a/src/views/tainacan-admin-i18n.php
+++ b/src/views/tainacan-admin-i18n.php
@@ -510,7 +510,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_select_a_taxonomy' => __( 'Select a taxonomy', 'tainacan' ),
'label_items_with_this_metadum_value' => __( 'Items with this metadatum value', 'tainacan' ),
'label_amount_of_items_per_metadatum_value' => __( 'Amount of items per metadatum value', 'tainacan' ),
-
+ 'label_activities_last_year' => __( 'Activities last year', 'tainacan' ),
+
// Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
'instruction_delete_selected_items' => __( 'Delete selected items', 'tainacan' ),