1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

handle deleted user in statistics

This commit is contained in:
Sylvain 2019-06-12 12:40:43 +02:00
parent a53c6e80e7
commit 0e18defe53
6 changed files with 21 additions and 6 deletions

View File

@ -263,9 +263,15 @@
<tbody>
<tr ng-repeat="datum in data">
<td>{{formatDate(datum._source.date)}}</td>
<td><a href="" ui-sref="app.admin.members_edit({id:datum._source.userId})">{{getUserNameFromId(datum._source.userId)}}</a></td>
<td>
<a ng-show="datum._source.userId" ui-sref="app.admin.members_edit({id:datum._source.userId})">{{getUserNameFromId(datum._source.userId)}}</a>
<span class="text-gray text-italic" ng-hide="datum._source.userId" translate>{{ 'deleted_user' }}</span>
</td>
<td>{{formatSex(datum._source.gender)}}</td>
<td><span ng-if="datum._source.age">{{datum._source.age}} {{ 'years_old' | translate }}</span><span ng-if="!datum._source.age" translate>{{ 'unknown' }}</span></td>
<td>
<span ng-if="datum._source.age">{{datum._source.age}} {{ 'years_old' | translate }}</span>
<span ng-if="!datum._source.age" translate>{{ 'unknown' }}</span>
</td>
<td>{{formatSubtype(datum._source.subType)}}</td>
<td ng-if="!type.active.simple">{{datum._source.stat}}</td>
<td ng-repeat="field in selectedIndex.additional_fields">

View File

@ -588,6 +588,7 @@ en:
export_all_statistics: "Export all statistics"
export_the_current_search_results: "Export the current search results"
export: "Export"
deleted_user: "Deleted user"
stats_graphs:
# statistics graphs

View File

@ -85,7 +85,7 @@ es:
training_validation: "Validación de la formación"
training_of_the_ : "Training of the " # context: fecha. p.ej. "entrenamiento del 1 de septiembre 2012"
you_can_validate_the_training_of_the_following_members: "Puede validar la formación de los siguientes miembros:"
deleted_user: "Deleted user" # translation_missing
deleted_user: "Usario eliminado"
no_reservation: "Sin reserva"
validate_the_trainings: "Validar los entrenamientos"
edition_of_the_description_tooltip: "Edición de la descripción tooltip"
@ -588,6 +588,7 @@ es:
export_all_statistics: "Exportar todas las estadísticas"
export_the_current_search_results: "Exportar los resultados de búsqueda actuales"
export: "Exportar"
deleted_user: "Usario eliminado"
stats_graphs:
# statistics graphs

View File

@ -588,6 +588,7 @@ fr:
export_all_statistics: "Exporter toutes les statistiques"
export_the_current_search_results: "Exporter les résultats de la recherche courante"
export: "Exporter"
deleted_user: "Utilisateur supprimé"
stats_graphs:
# graphiques de statistiques

View File

@ -588,6 +588,7 @@ pt:
export_all_statistics: "Exportar todas estatísticas"
export_the_current_search_results: "Exportar resultados encontrados"
export: "Exportar"
deleted_user: "Deleted user" # translation_missing
stats_graphs:
# statistics graphs

View File

@ -151,14 +151,19 @@ namespace :fablab do
end
desc '(re)generate statistics in ElasticSearch for the past period'
desc '(re)generate statistics in ElasticSearch for the past period. Use 0 to generate for today'
task :generate_stats, [:period] => :environment do |_task, args|
raise 'FATAL ERROR: You must pass a number of days (=> past period) to generate statistics on' unless args.period
days = args.period.to_i
days.times.each do |i|
StatisticService.new.generate_statistic(start_date: i.day.ago.beginning_of_day, end_date: i.day.ago.end_of_day)
if days.zero?
StatisticService.new.generate_statistic(start_date: DateTime.now.beginning_of_day, end_date: DateTime.now.end_of_day)
else
days.times.each do |i|
StatisticService.new.generate_statistic(start_date: i.day.ago.beginning_of_day, end_date: i.day.ago.end_of_day)
end
end
end
end