1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

(feat) filter stats by item date

This commit is contained in:
Sylvain 2023-02-02 11:11:42 +01:00
commit 0fd4bcbf19
27 changed files with 245 additions and 162 deletions

View File

@ -10,7 +10,7 @@
- Fix a bug: do not show catgory select in plan form if no options were set
- Fix a bug: new setups doesn't log
- [TODO DEPLOY] `rails db:seed`
- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2014,1]`
- [TODO DEPLOY] `rails fablab:es:build_stats` THEN `rails fablab:maintenance:regenerate_statistics[2014,1]`
## v5.6.8 2023 January 26

View File

@ -233,6 +233,14 @@ Application.Controllers.controller('StatisticsController', ['$scope', '$state',
}
};
/**
* Return unique elements from the given array
* @param elements {Array<any>}
*/
$scope.uniq = function (elements) {
return [...new Set(elements)];
};
/**
* Retrieve the label for the given subtype in the current type
* @param key {string} statistic subtype key

View File

@ -254,7 +254,8 @@
<table class="table">
<thead>
<tr>
<th translate>{{ 'app.admin.statistics.date' }}</th>
<th ng-if="['booking', 'hour'].includes(type.active.key)" translate>{{ 'app.admin.statistics.reservation_date' }}</th>
<th ng-if="!['booking', 'hour'].includes(type.active.key)" translate>{{ 'app.admin.statistics.date' }}</th>
<th translate>{{ 'app.admin.statistics.user' }}</th>
<th translate>{{ 'app.admin.statistics.gender' }}</th>
<th translate>{{ 'app.admin.statistics.age' }}</th>
@ -290,7 +291,7 @@
<ng-switch on="field.data_type">
<span ng-switch-when="date">{{formatDate(datum._source[field.key])}}</span>
<ul ng-switch-when="list">
<li ng-repeat="elem in datum._source[field.key]">{{elem.name}}</li>
<li ng-repeat="elem in uniq(datum._source[field.key])">{{elem.name}}</li>
</ul>
<span ng-switch-default>{{datum._source[field.key]}}</span>
</ng-switch>

View File

@ -56,7 +56,7 @@ class Statistics::Builders::ReservationsBuilderService
def add_machine_attributes(category, stat, reservation_data)
return stat unless category == 'machine'
stat[:machineDates] = reservation_data[:slot_dates]
stat[:machineDates] = reservation_data[:slot_dates].map { |date| { name: date } }
stat
end
@ -64,7 +64,7 @@ class Statistics::Builders::ReservationsBuilderService
def add_space_attributes(category, stat, reservation_data)
return stat unless category == 'space'
stat[:spaceDates] = reservation_data[:slot_dates]
stat[:spaceDates] = reservation_data[:slot_dates].map { |date| { name: date } }
stat
end

View File

@ -200,8 +200,8 @@ de:
#add a new machine
machines_new:
declare_a_new_machine: "Neue Maschine angeben"
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Achtung! Beim Erstellen einer neuen Maschine werden die Preise für alle Abonnements auf 0 initialisiert."
consider_changing_them_before_creating_any_reservation_slot: "Denken Sie daran, sie zu ändern, bevor Sie einen Reservierungsplatz erstellen."
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new machine, its prices are initialized at 0 for all subscriptions."
consider_changing_them_before_creating_any_reservation_slot: "Consider changing them before creating any reservation slot."
#machine edition
machines_edit:
machine_edit: "Maschine bearbeiten"
@ -370,12 +370,12 @@ de:
#track and monitor the trainings
trainings:
trainings_monitoring: "Schulungs-Überwachung"
plan_session: "Neue Sitzung planen"
trainings: "Schulungen"
plan_session: "Schedule a new session"
trainings: "Trainings"
add_a_new_training: "Neue Schulung hinzufügen"
name: "Name"
associated_machines: "Verknüpfte Maschinen"
number_of_tickets: "Anzahl der Tickets"
number_of_tickets: "Number of tickets"
select_a_training: "Schulung auswählen"
training: "Schulung"
date: "Datum"
@ -403,8 +403,8 @@ de:
#create a new training
trainings_new:
add_a_new_training: "Neue Schulung hinzufügen"
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Vorsicht bei der Erstellung eines Trainings, die Reservierungspreise stehen auf Null."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Vergesse nicht, sie anzupassen, bevor du das Training aktivierst."
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training."
#events tracking and management
events:
events_monitoring: "Ereignisüberwachung"
@ -610,15 +610,15 @@ de:
create_pack: "Dieses Paket erstellen"
pack_successfully_created: "Das neue Vorausbezahlungs-Paket wurde erfolgreich erstellt."
delete_pack:
pack_deleted: "Das Vorausbezahlungs-Paket wurde erfolgreich gelöscht."
unable_to_delete: "Paket konnte nicht gelöscht werden: "
delete_pack: "Vorausbezahlungs-Paket löschen"
confirm_delete: "Löschen"
delete_confirmation: "Sind Sie sicher, dass Sie dieses Paket löschen möchten? Dies ist nicht möglich, wenn das Paket bereits von Benutzern gekauft wurde."
pack_deleted: "The prepaid pack was successfully deleted."
unable_to_delete: "Unable to delete the prepaid pack: "
delete_pack: "Delete the prepaid pack"
confirm_delete: "Delete"
delete_confirmation: "Are you sure you want to delete this prepaid pack? This won't be possible if the pack was already bought by users."
edit_pack:
edit_pack: "Das Paket bearbeiten"
confirm_changes: "Änderungen bestätigen"
pack_successfully_updated: "Das Vorausbezahlungs-Paket wurde erfolgreich aktualisiert."
edit_pack: "Edit the pack"
confirm_changes: "Confirm changes"
pack_successfully_updated: "The prepaid pack was successfully updated."
create_extended_price:
new_extended_price: "Neuer erweiterter Preis"
new_extended_price_info: "Erweiterte Preise erlauben Ihnen die Festlegung von Preisen basierend auf benutzerdefinierten Zeitdauern anstelle der Standard-Stundensätze."
@ -1377,6 +1377,7 @@ de:
available_hours: "Öffnungszeiten für Buchung:"
available_tickets: "Verfügbare Tickets zur Buchung:"
date: "Datum"
reservation_date: "Reservation date"
user: "Nutzer"
gender: "Geschlecht"
age: "Alter"
@ -1821,9 +1822,9 @@ de:
#create a new space
space_new:
add_a_new_space: "Neuen Raum erstellen"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Achtung! Beim Erstellen eines neuen Raums wird sein Preis für alle Abonnements mit 0 angelegt."
consider_changing_its_prices_before_creating_any_reservation_slot: "Ändern Sie ggf. die Preise, bevor Sie Reservierungs-Slots erstellen."
add_this_space: "Diesen Raum hinzufügen"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions."
consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot."
add_this_space: "Add this space"
#modify an exiting space
space_edit:
edit_the_space_NAME: "Bearbeite den Raum: {NAME}"

View File

@ -1377,6 +1377,7 @@ en:
available_hours: "Hours available for booking:"
available_tickets: "Tickets available for booking:"
date: "Date"
reservation_date: "Reservation date"
user: "User"
gender: "Gender"
age: "Age"

View File

@ -200,8 +200,8 @@ es:
#add a new machine
machines_new:
declare_a_new_machine: "Declara una nueva máquina"
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Cuidado al crear una nueva máquina, los precios están inicializados a 0 para todas las subscripciones."
consider_changing_them_before_creating_any_reservation_slot: "Considera cambiarlos antes de crear cualquier ranura de reserva."
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new machine, its prices are initialized at 0 for all subscriptions."
consider_changing_them_before_creating_any_reservation_slot: "Consider changing them before creating any reservation slot."
#machine edition
machines_edit:
machine_edit: "Editar una máquina"
@ -403,8 +403,8 @@ es:
#create a new training
trainings_new:
add_a_new_training: "Add a new training"
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Tenga cuidado, al crear una formación, sus precios de reserva se inicializan en cero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "No olvides cambiarlos antes de crear espacios para esta formación."
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training."
#events tracking and management
events:
events_monitoring: "Monitoreo de eventos"
@ -1377,6 +1377,7 @@ es:
available_hours: "Horas disponibles para reservar:"
available_tickets: "Tickets disponibles para reservar:"
date: "Date"
reservation_date: "Reservation date"
user: "User"
gender: "Genero"
age: "Edad"
@ -1821,9 +1822,9 @@ es:
#create a new space
space_new:
add_a_new_space: "Añadir un espacio nuevo"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "¡Cuidado! Al crear un nuevo espacio, sus precios se inicializan en 0 para todas las suscripciones."
consider_changing_its_prices_before_creating_any_reservation_slot: "Considere cambiar sus precios antes de crear cualquier espacio de reserva."
add_this_space: "Añadir este espacio"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions."
consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot."
add_this_space: "Add this space"
#modify an exiting space
space_edit:
edit_the_space_NAME: "Edit the space: {NAME}"

View File

@ -1377,6 +1377,7 @@ fr:
available_hours: "Heures disponibles à la réservation :"
available_tickets: "Places disponibles à la reservation :"
date: "Date"
reservation_date: "Date de réservation"
user: "Utilisateur"
gender: "Genre"
age: "Âge"

View File

@ -200,8 +200,8 @@
#add a new machine
machines_new:
declare_a_new_machine: "Sett opp en ny maskin"
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Vær oppmerksom på at når en ny maskin settes opp blir alle priser satt lik null."
consider_changing_them_before_creating_any_reservation_slot: "Vurder å endre før nye reserveringer gjøres."
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new machine, its prices are initialized at 0 for all subscriptions."
consider_changing_them_before_creating_any_reservation_slot: "Consider changing them before creating any reservation slot."
#machine edition
machines_edit:
machine_edit: "Rediger en maskin"
@ -370,12 +370,12 @@
#track and monitor the trainings
trainings:
trainings_monitoring: "Oversikt over opplæring, kurs mm."
plan_session: "Planlegg en ny økt"
trainings: "Opplæringer/kurs"
plan_session: "Schedule a new session"
trainings: "Trainings"
add_a_new_training: "Legge til ny opplæring/nytt kurs"
name: "Navn"
associated_machines: "Tilknyttede maskiner"
number_of_tickets: "Antall billetter"
number_of_tickets: "Number of tickets"
select_a_training: "Velg opplæring/kurs"
training: "Opplæringer/kurs"
date: "Dato"
@ -403,8 +403,8 @@
#create a new training
trainings_new:
add_a_new_training: "Legge til ny opplæring/nytt kurs"
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Vær oppmerksom på at ved oppretting av kursing eller opplæring settes reservasjonsprisene lik null."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Ikke glem å endre dem før du velger tidskluke for denne treningen."
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training."
#events tracking and management
events:
events_monitoring: "Oversikt over arrangementer"
@ -610,15 +610,15 @@
create_pack: "Opprett denne pakken"
pack_successfully_created: "Den nye forhåndsbetalte pakken ble opprettet."
delete_pack:
pack_deleted: "Den forhåndsbetalte pakken ble slettet."
unable_to_delete: "Kan ikke slette forhåndsbetalt pakke: "
delete_pack: "Slette den forhåndsbetalte pakken"
confirm_delete: "Slett"
delete_confirmation: "Er du sikker på at du vil slette denne forhåndsbetalte pakken? Dette vil ikke være mulig hvis pakken allerede er kjøpt av brukere."
pack_deleted: "The prepaid pack was successfully deleted."
unable_to_delete: "Unable to delete the prepaid pack: "
delete_pack: "Delete the prepaid pack"
confirm_delete: "Delete"
delete_confirmation: "Are you sure you want to delete this prepaid pack? This won't be possible if the pack was already bought by users."
edit_pack:
edit_pack: "Rediger pakken"
confirm_changes: "Bekreft endringer"
pack_successfully_updated: "Den forhåndsbetalte pakken ble oppdatert."
edit_pack: "Edit the pack"
confirm_changes: "Confirm changes"
pack_successfully_updated: "The prepaid pack was successfully updated."
create_extended_price:
new_extended_price: "New extended price"
new_extended_price_info: "Extended prices allows you to define prices based on custom durations, instead of the default hourly rates."
@ -1377,6 +1377,7 @@
available_hours: "Timer tilgjengelig for reservering:"
available_tickets: "Billetter tilgjengelig for bestilling:"
date: "Dato"
reservation_date: "Reservation date"
user: "Bruker"
gender: "Kjønn"
age: "Alder"
@ -1821,9 +1822,9 @@
#create a new space
space_new:
add_a_new_space: "Legg til ny plass eller rom"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Pass på! Når du oppretter ny plass eller rom, settes alle priser til null for alle abonnementer."
consider_changing_its_prices_before_creating_any_reservation_slot: "Vurder å endre prisene før du lager en tidsluke."
add_this_space: "Legg til dette rommet/plassen"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions."
consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot."
add_this_space: "Add this space"
#modify an exiting space
space_edit:
edit_the_space_NAME: "Rediger rommet/plassen: {NAME}"

View File

@ -200,8 +200,8 @@ pt:
#add a new machine
machines_new:
declare_a_new_machine: "Criar nova máquina"
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Cuidado! Ao criar uma nova máquina, os preços são inicializados em 0 para todas as assinaturas."
consider_changing_them_before_creating_any_reservation_slot: "Concidere alterá-lo antes de criar qualquer slot de reserva."
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new machine, its prices are initialized at 0 for all subscriptions."
consider_changing_them_before_creating_any_reservation_slot: "Consider changing them before creating any reservation slot."
#machine edition
machines_edit:
machine_edit: "Editar máquina"
@ -370,12 +370,12 @@ pt:
#track and monitor the trainings
trainings:
trainings_monitoring: "Treinamentos"
plan_session: "Agendar uma nova sessão"
trainings: "Treinamentos"
plan_session: "Schedule a new session"
trainings: "Trainings"
add_a_new_training: "Adicionar um novo treinamento"
name: "Nome"
associated_machines: "Máquinas associadas"
number_of_tickets: "Número de vagas"
number_of_tickets: "Number of tickets"
select_a_training: "Selecione um treinamento"
training: "Treinamento"
date: "Data"
@ -403,8 +403,8 @@ pt:
#create a new training
trainings_new:
add_a_new_training: "Adicionar um novo treinamento"
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Cuidado, ao criar um treinamento, seu preço de reserva é inicializado em zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Não se esqueça de alterá-lo antes de criar slots para este treinamento."
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "Beware, when creating a training, its reservation prices are initialized at zero."
dont_forget_to_change_them_before_creating_slots_for_this_training: "Don't forget to change them before creating slots for this training."
#events tracking and management
events:
events_monitoring: "Monitoramento de eventos"
@ -610,15 +610,15 @@ pt:
create_pack: "Criar este pacote"
pack_successfully_created: "O novo pacote pré-pago foi criado com sucesso."
delete_pack:
pack_deleted: "O pacote pré-pago foi deletado com sucesso."
unable_to_delete: "Não foi possível deletar o pacote pré-pago: "
delete_pack: "Excluir o pacote pré-pago"
confirm_delete: "Deletar"
delete_confirmation: "Tem certeza que deseja excluir este pacote pré-pago? Isto não será possível se o pacote já foi comprado pelos usuários."
pack_deleted: "The prepaid pack was successfully deleted."
unable_to_delete: "Unable to delete the prepaid pack: "
delete_pack: "Delete the prepaid pack"
confirm_delete: "Delete"
delete_confirmation: "Are you sure you want to delete this prepaid pack? This won't be possible if the pack was already bought by users."
edit_pack:
edit_pack: "Editar o pacote"
confirm_changes: "Confirmar alterações"
pack_successfully_updated: "O pacote pré-pago foi atualizado com sucesso."
edit_pack: "Edit the pack"
confirm_changes: "Confirm changes"
pack_successfully_updated: "The prepaid pack was successfully updated."
create_extended_price:
new_extended_price: "Novo preço estendido"
new_extended_price_info: "Preços estendidos permitem que você defina preços baseados em durações personalizadas, ao invés das taxas padrão por hora."
@ -1377,6 +1377,7 @@ pt:
available_hours: "Horas disponíveis para reserva:"
available_tickets: "Vagas disponíveis para reserva:"
date: "Data"
reservation_date: "Reservation date"
user: "Usuário"
gender: "Gênero"
age: "Ano"
@ -1474,9 +1475,9 @@ pt:
max_visibility: "Visibilidade máxima (em meses)"
visibility_for_yearly_members: "Para inscrições atuais de pelo menos 1 ano"
visibility_for_other_members: "Para todos os outros membros"
reservation_deadline: "Prevent last minute booking"
reservation_deadline_help: "If you increase the prior period, members won't be able to book a slot X minutes before its start."
deadline_minutes: "Prior period (minutes)"
reservation_deadline: "Impedir a reserva da última hora"
reservation_deadline_help: "Se você aumentar o período prévio, os membros não serão capazes de reservar um slot X minutos antes do seu início."
deadline_minutes: "Período prévio (minutos)"
ability_for_the_users_to_move_their_reservations: "Habilidade para os usuários mover suas reservas"
reservations_shifting: "Mudança de reservas"
prior_period_hours: "Período anterior (horas)"
@ -1821,9 +1822,9 @@ pt:
#create a new space
space_new:
add_a_new_space: "Adicionar um novo espaço"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Cuidado! Ao criar um novo espaço, seus preços são inicializados em 0 para todas as assinaturas."
consider_changing_its_prices_before_creating_any_reservation_slot: "Considere alterar seus preços antes de criar qualquer slot de reserva."
add_this_space: "Adicionar este espaço"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "Watch out! When creating a new space, its prices are initialized at 0 for all subscriptions."
consider_changing_its_prices_before_creating_any_reservation_slot: "Consider changing its prices before creating any reservation slot."
add_this_space: "Add this space"
#modify an exiting space
space_edit:
edit_the_space_NAME: "Editar o espaço: {NAME}"

View File

@ -27,7 +27,7 @@ zu:
confirm: "crwdns36099:0crwdne36099:0"
deleted: "crwdns36101:0crwdne36101:0"
unable_to_delete: "crwdns36103:0crwdne36103:0"
confirm_delete_supporting_documents_type: "crwdns36105:0crwdne36105:0"
confirm_delete_supporting_documents_type: "crwdns36707:0crwdne36707:0"
machine_form:
name: "crwdns31659:0crwdne31659:0"
illustration: "crwdns31661:0crwdne31661:0"
@ -40,7 +40,7 @@ zu:
disabled_help: "crwdns31677:0crwdne31677:0"
reservable: "crwdns36217:0crwdne36217:0"
reservable_help: "crwdns36253:0crwdne36253:0"
ACTION_machine: "crwdns31757:0ACTION={ACTION}crwdne31757:0"
ACTION_machine: "crwdns36709:0ACTION={ACTION}crwdne36709:0"
create_success: "crwdns31759:0crwdne31759:0"
update_success: "crwdns31761:0crwdne31761:0"
training_form:
@ -56,7 +56,7 @@ zu:
public_help: "crwdns31781:0crwdne31781:0"
disable_training: "crwdns31783:0crwdne31783:0"
disabled_help: "crwdns31785:0crwdne31785:0"
ACTION_training: "crwdns31787:0ACTION={ACTION}crwdne31787:0"
ACTION_training: "crwdns36711:0ACTION={ACTION}crwdne36711:0"
create_success: "crwdns31789:0crwdne31789:0"
update_success: "crwdns31791:0crwdne31791:0"
space_form:
@ -69,7 +69,7 @@ zu:
default_seats: "crwdns31805:0crwdne31805:0"
disable_space: "crwdns31807:0crwdne31807:0"
disabled_help: "crwdns31809:0crwdne31809:0"
ACTION_space: "crwdns31811:0ACTION={ACTION}crwdne31811:0"
ACTION_space: "crwdns36713:0ACTION={ACTION}crwdne36713:0"
create_success: "crwdns31813:0crwdne31813:0"
update_success: "crwdns31815:0crwdne31815:0"
event_form:
@ -98,7 +98,7 @@ zu:
event_themes: "crwdns31861:0crwdne31861:0"
age_range: "crwdns31863:0crwdne31863:0"
add_price: "crwdns31865:0crwdne31865:0"
ACTION_event: "crwdns31867:0ACTION={ACTION}crwdne31867:0"
ACTION_event: "crwdns36715:0ACTION={ACTION}crwdne36715:0"
create_success: "crwdns31869:0crwdne31869:0"
events_updated: "crwdns31871:0COUNT={COUNT}crwdnd31871:0COUNT={COUNT}crwdne31871:0"
events_not_updated: "crwdns31873:0TOTAL={TOTAL}crwdnd31873:0TOTAL={TOTAL}crwdnd31873:0COUNT={COUNT}crwdnd31873:0COUNT={COUNT}crwdne31873:0"
@ -200,8 +200,8 @@ zu:
#add a new machine
machines_new:
declare_a_new_machine: "crwdns24050:0crwdne24050:0"
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "crwdns24052:0crwdne24052:0"
consider_changing_them_before_creating_any_reservation_slot: "crwdns24054:0crwdne24054:0"
watch_out_when_creating_a_new_machine_its_prices_are_initialized_at_0_for_all_subscriptions: "crwdns36717:0crwdne36717:0"
consider_changing_them_before_creating_any_reservation_slot: "crwdns36719:0crwdne36719:0"
#machine edition
machines_edit:
machine_edit: "crwdns24056:0crwdne24056:0"
@ -370,12 +370,12 @@ zu:
#track and monitor the trainings
trainings:
trainings_monitoring: "crwdns24368:0crwdne24368:0"
plan_session: "crwdns24370:0crwdne24370:0"
trainings: "crwdns24372:0crwdne24372:0"
plan_session: "crwdns36721:0crwdne36721:0"
trainings: "crwdns36723:0crwdne36723:0"
add_a_new_training: "crwdns24374:0crwdne24374:0"
name: "crwdns24376:0crwdne24376:0"
associated_machines: "crwdns24378:0crwdne24378:0"
number_of_tickets: "crwdns24380:0crwdne24380:0"
number_of_tickets: "crwdns36725:0crwdne36725:0"
select_a_training: "crwdns24382:0crwdne24382:0"
training: "crwdns24384:0crwdne24384:0"
date: "crwdns24386:0crwdne24386:0"
@ -403,8 +403,8 @@ zu:
#create a new training
trainings_new:
add_a_new_training: "crwdns24430:0crwdne24430:0"
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "crwdns24432:0crwdne24432:0"
dont_forget_to_change_them_before_creating_slots_for_this_training: "crwdns24434:0crwdne24434:0"
beware_when_creating_a_training_its_reservation_prices_are_initialized_to_zero: "crwdns36727:0crwdne36727:0"
dont_forget_to_change_them_before_creating_slots_for_this_training: "crwdns36729:0crwdne36729:0"
#events tracking and management
events:
events_monitoring: "crwdns24436:0crwdne24436:0"
@ -610,15 +610,15 @@ zu:
create_pack: "crwdns24804:0crwdne24804:0"
pack_successfully_created: "crwdns24806:0crwdne24806:0"
delete_pack:
pack_deleted: "crwdns24808:0crwdne24808:0"
unable_to_delete: "crwdns24810:0crwdne24810:0"
delete_pack: "crwdns24812:0crwdne24812:0"
confirm_delete: "crwdns24814:0crwdne24814:0"
delete_confirmation: "crwdns24816:0crwdne24816:0"
pack_deleted: "crwdns36731:0crwdne36731:0"
unable_to_delete: "crwdns36733:0crwdne36733:0"
delete_pack: "crwdns36735:0crwdne36735:0"
confirm_delete: "crwdns36737:0crwdne36737:0"
delete_confirmation: "crwdns36739:0crwdne36739:0"
edit_pack:
edit_pack: "crwdns24818:0crwdne24818:0"
confirm_changes: "crwdns24820:0crwdne24820:0"
pack_successfully_updated: "crwdns24822:0crwdne24822:0"
edit_pack: "crwdns36741:0crwdne36741:0"
confirm_changes: "crwdns36743:0crwdne36743:0"
pack_successfully_updated: "crwdns36745:0crwdne36745:0"
create_extended_price:
new_extended_price: "crwdns24824:0crwdne24824:0"
new_extended_price_info: "crwdns24826:0crwdne24826:0"
@ -1377,6 +1377,7 @@ zu:
available_hours: "crwdns26262:0crwdne26262:0"
available_tickets: "crwdns26264:0crwdne26264:0"
date: "crwdns26266:0crwdne26266:0"
reservation_date: "crwdns36747:0crwdne36747:0"
user: "crwdns26268:0crwdne26268:0"
gender: "crwdns26270:0crwdne26270:0"
age: "crwdns26272:0crwdne26272:0"
@ -1821,9 +1822,9 @@ zu:
#create a new space
space_new:
add_a_new_space: "crwdns27066:0crwdne27066:0"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "crwdns27068:0crwdne27068:0"
consider_changing_its_prices_before_creating_any_reservation_slot: "crwdns27070:0crwdne27070:0"
add_this_space: "crwdns27072:0crwdne27072:0"
watch_out_when_creating_a_new_space_its_prices_are_initialized_at_0_for_all_subscriptions: "crwdns36749:0crwdne36749:0"
consider_changing_its_prices_before_creating_any_reservation_slot: "crwdns36751:0crwdne36751:0"
add_this_space: "crwdns36753:0crwdne36753:0"
#modify an exiting space
space_edit:
edit_the_space_NAME: "crwdns27074:0{NAME}crwdne27074:0"
@ -2174,8 +2175,8 @@ zu:
assigning_category_info: "crwdns31428:0crwdne31428:0"
assigning_machines: "crwdns31430:0crwdne31430:0"
assigning_machines_info: "crwdns31432:0crwdne31432:0"
product_description: "crwdns31434:0crwdne31434:0"
product_description_info: "crwdns31436:0crwdne31436:0"
product_description: "crwdns36755:0crwdne36755:0"
product_description_info: "crwdns36757:0crwdne36757:0"
product_files: "crwdns31438:0crwdne31438:0"
product_files_info: "crwdns31440:0crwdne31440:0"
add_product_file: "crwdns31442:0crwdne31442:0"
@ -2191,7 +2192,7 @@ zu:
save_reminder: "crwdns31460:0crwdne31460:0"
low_stock_threshold: "crwdns31462:0crwdne31462:0"
stock_threshold_toggle: "crwdns31464:0crwdne31464:0"
stock_threshold_information: "crwdns31466:0crwdne31466:0"
stock_threshold_information: "crwdns36759:0crwdne36759:0"
low_stock: "crwdns31468:0crwdne31468:0"
threshold_level: "crwdns31470:0crwdne31470:0"
threshold_alert: "crwdns31472:0crwdne31472:0"

View File

@ -145,18 +145,18 @@ pt:
edit: "Editar"
reservations:
reservations_panel:
title_Space: "Minhas reservas de espaços"
title_Machine: "Minhas reservas de máquinas"
upcoming: "Próximas"
past: "Passadas"
slots_details: "Detalhes da reserva"
no_reservations: "Sem reservas"
show_more: "Mostrar mais"
title_Space: "My space reservations"
title_Machine: "My machines reservations"
upcoming: "Upcoming"
past: "Past"
slots_details: "Slots details"
no_reservations: "No reservations"
show_more: "Show more"
credits_panel:
title_Space: "Meus créditos de espaços"
title_Machine: "Meus créditos de máquinas"
reamaining_credits_html: "<strong>{NAME}</strong>: Você pode fazer <em>{REMAINING} {REMAINING, plural, one{reserva} other{reservas}}</em> gratuitamente. Você já usou {USED} {USED, plural, one{credito} other{creditos}} da sua assinatura."
no_credits: "Você não tem nenhum crédito ainda. Algumas assinaturas podem permitir que você reserve alguns slots gratuitamente."
title_Space: "My space credits"
title_Machine: "My machines credits"
reamaining_credits_html: "<strong>{NAME}</strong>: You can book <em>{REMAINING} {REMAINING, plural, one{slot} other{slots}}</em> for free. You have already used {USED} {USED, plural, one{credit} other{credits}} from your current subscription."
no_credits: "You don't have any credits yet. Some subscriptions may allow you to book some slots for free."
#public profil of a member
members_show:
members_list: "Lista de membros"

View File

@ -145,18 +145,18 @@ zu:
edit: "crwdns27632:0crwdne27632:0"
reservations:
reservations_panel:
title_Space: "crwdns36333:0crwdne36333:0"
title_Machine: "crwdns36335:0crwdne36335:0"
upcoming: "crwdns36337:0crwdne36337:0"
past: "crwdns36339:0crwdne36339:0"
slots_details: "crwdns36341:0crwdne36341:0"
no_reservations: "crwdns36343:0crwdne36343:0"
show_more: "crwdns36345:0crwdne36345:0"
title_Space: "crwdns36761:0crwdne36761:0"
title_Machine: "crwdns36763:0crwdne36763:0"
upcoming: "crwdns36765:0crwdne36765:0"
past: "crwdns36767:0crwdne36767:0"
slots_details: "crwdns36769:0crwdne36769:0"
no_reservations: "crwdns36771:0crwdne36771:0"
show_more: "crwdns36773:0crwdne36773:0"
credits_panel:
title_Space: "crwdns36347:0crwdne36347:0"
title_Machine: "crwdns36349:0crwdne36349:0"
reamaining_credits_html: "crwdns36351:0NAME={NAME}crwdnd36351:0REMAINING={REMAINING}crwdnd36351:0REMAINING={REMAINING}crwdnd36351:0USED={USED}crwdnd36351:0USED={USED}crwdne36351:0"
no_credits: "crwdns36353:0crwdne36353:0"
title_Space: "crwdns36775:0crwdne36775:0"
title_Machine: "crwdns36777:0crwdne36777:0"
reamaining_credits_html: "crwdns36779:0NAME={NAME}crwdnd36779:0REMAINING={REMAINING}crwdnd36779:0REMAINING={REMAINING}crwdnd36779:0USED={USED}crwdnd36779:0USED={USED}crwdne36779:0"
no_credits: "crwdns36781:0crwdne36781:0"
#public profil of a member
members_show:
members_list: "crwdns27656:0crwdne27656:0"

View File

@ -169,13 +169,13 @@ de:
projects_list:
the_fablab_projects: "The projects"
add_a_project: "Projekt hinzufügen"
search_over_the_whole_network: "Suche über das gesamte Fab-Manager-Netzwerk"
search_over_the_whole_network: "Search over the whole Fab-manager network"
tooltip_openlab_projects_switch: "Mit der Suche über das gesamte Netzwerk können Sie die Projekte aller Fab-Manager durchsuchen, die diese Funktion nutzen!"
openlab_search_not_available_at_the_moment: "Suche über das gesamte Netzwerk ist derzeit nicht verfügbar. Sie können nach Projekten auf dieser Plattform suchen."
project_search_result_is_empty: "Leider haben wir keine Ergebnisse gefunden, die Ihren Suchkriterien entsprechen."
reset_all_filters: "Alle Filter zurücksetzen"
keywords: "Schlüsselwörter"
search: "Suche"
search: "Search"
all_projects: "Alle Projekte"
my_projects: "Meine Projekte"
projects_to_whom_i_take_part_in: "Projekte, an denen ich beteiligt bin"

View File

@ -169,13 +169,13 @@ es:
projects_list:
the_fablab_projects: "The projects"
add_a_project: "Añadir un proyecto"
search_over_the_whole_network: "Buscar en toda la red de FabLab"
search_over_the_whole_network: "Search over the whole Fab-manager network"
tooltip_openlab_projects_switch: "La busqueda en toda la red le permite buscar los proyectos de todos los FabLab que usan esta característica"
openlab_search_not_available_at_the_moment: "La busqueda en toda la red no está disponible en este momento. Puede seguir buscando proyectos en este FabLab."
project_search_result_is_empty: "Lo sentimos, no hemos encontrado nada."
reset_all_filters: "Limpiar filtros"
keywords: "Palabras clave"
search: "Buscar"
search: "Search"
all_projects: "Todos los proyectos"
my_projects: "Mis proyectos"
projects_to_whom_i_take_part_in: "Proyectos de los que formo parte"

View File

@ -169,13 +169,13 @@
projects_list:
the_fablab_projects: "The projects"
add_a_project: "Legg til et prosjekt"
search_over_the_whole_network: "Søk over hele Fab-manager-nettverket"
search_over_the_whole_network: "Search over the whole Fab-manager network"
tooltip_openlab_projects_switch: "Søk i hele nettverket lar deg søke i prosjekter for hver Fab-manager ved hjelp av denne funksjonen!"
openlab_search_not_available_at_the_moment: "Det er ikke mulig å søke over hele nettverket for øyeblikket. Du kan fortsatt søke over prosjektene her."
project_search_result_is_empty: "Beklager, fant vi ingen resultater som samsvarte med dine søkekriterier."
reset_all_filters: "Tilbakestill alle filtre"
keywords: "Nøkkelord"
search: "Søk"
search: "Search"
all_projects: "Alle prosjekter"
my_projects: "Mine prosjekter"
projects_to_whom_i_take_part_in: "Prosjekter jeg deltar i"

View File

@ -169,13 +169,13 @@ pt:
projects_list:
the_fablab_projects: "The projects"
add_a_project: "Adicionar projeto"
search_over_the_whole_network: "Pesquisar em todos os FabLabs"
search_over_the_whole_network: "Search over the whole Fab-manager network"
tooltip_openlab_projects_switch: "A busca em todos os FabLabs busca projetos em todos os FabLabs que usam o Fab-manager !"
openlab_search_not_available_at_the_moment: "A busca em toda a rede de FabLabs não está disponível no momento. Você pode procurar por projetos nesta plataforma."
project_search_result_is_empty: "Desculpe, nós não achamos nenhum resultado para sua pesquisa."
reset_all_filters: "Resetar todos os filtros"
keywords: "Palavras-chave"
search: "Procurar"
search: "Search"
all_projects: "Todos os projetos"
my_projects: "Meus Projetos"
projects_to_whom_i_take_part_in: "Projetos que eu participo"

View File

@ -169,13 +169,13 @@ zu:
projects_list:
the_fablab_projects: "crwdns36237:0crwdne36237:0"
add_a_project: "crwdns28062:0crwdne28062:0"
search_over_the_whole_network: "crwdns28064:0crwdne28064:0"
search_over_the_whole_network: "crwdns36783:0crwdne36783:0"
tooltip_openlab_projects_switch: "crwdns28066:0crwdne28066:0"
openlab_search_not_available_at_the_moment: "crwdns28068:0crwdne28068:0"
project_search_result_is_empty: "crwdns28070:0crwdne28070:0"
reset_all_filters: "crwdns28072:0crwdne28072:0"
keywords: "crwdns28074:0crwdne28074:0"
search: "crwdns28076:0crwdne28076:0"
search: "crwdns36785:0crwdne36785:0"
all_projects: "crwdns28078:0crwdne28078:0"
my_projects: "crwdns28080:0crwdne28080:0"
projects_to_whom_i_take_part_in: "crwdns28082:0crwdne28082:0"

View File

@ -13,8 +13,8 @@ de:
activerecord:
attributes:
product:
amount: "The price"
slug: "URL"
amount: "Der Preis"
slug: "Link"
errors:
#CarrierWave
messages:
@ -64,7 +64,7 @@ de:
i_ve_reserved: "Ich reservierte"
length_must_be_slot_multiple: "muss mindestens %{MIN} Minuten nach dem Startdatum liegen"
must_be_associated_with_at_least_1_machine: "muss mindestens einer Maschine zugeordnet sein"
deleted_user: "Deleted user"
deleted_user: "Gelöschte Benutzer"
#members management
members:
unable_to_change_the_group_while_a_subscription_is_running: "Die Gruppe kann während eines Abonnements nicht geändert werden"
@ -133,8 +133,8 @@ de:
error_invoice: "Fehlerhafte Rechnung. Die folgenden Artikel sind nicht gebucht. Bitte kontaktieren Sie das FabLab für eine Rückerstattung."
prepaid_pack: "Prepaid-Stundenpaket"
pack_item: "Paket von %{COUNT} Stunden für %{ITEM}"
order: "Your order on the store"
unable_to_find_pdf: "We cannot find your invoice. If you ordered recently, it may have not been generated yet. Please retry in a moment."
order: "Ihre Bestellung im Shop"
unable_to_find_pdf: "Wir können Ihre Rechnung nicht finden. Wenn Sie erst kürzlich bestellt haben, wurde sie möglicherweise noch nicht generiert. Bitte versuchen Sie es in einem Moment erneut."
#PDF payment schedule generation
payment_schedules:
schedule_reference: "Zahlungsplan Referenz: %{REF}"
@ -373,7 +373,7 @@ de:
view_results: "Ergebnisse anzeigen."
notify_admin_low_stock_threshold:
low_stock: "Low stock for %{PRODUCT}. "
view_product: "View the product."
view_product: "Produkt anzeigen."
notify_member_about_coupon:
enjoy_a_discount_of_PERCENT_with_code_CODE: "Erhalten Sie %{PERCENT}% Rabatt mit dem Code %{CODE}"
enjoy_a_discount_of_AMOUNT_with_code_CODE: "Erhalten Sie %{AMOUNT}% Rabatt mit dem Code %{CODE}"
@ -418,11 +418,11 @@ de:
notify_admin_user_proof_of_identity_files_updated:
proof_of_identity_files_uploaded: "Proof of identity changed by Member <strong><em>%{NAME}</strong></em>."
notify_user_is_validated:
account_validated: "Your account is valid."
account_validated: "Dein Account ist gültig."
notify_user_is_invalidated:
account_invalidated: "Your account is invalid."
account_invalidated: "Dein Account ist ungültig."
notify_user_proof_of_identity_refusal:
refusal: "Your proof of identity are not accepted"
refusal: "Ihr Identitätsnachweis wird nicht akzeptiert"
notify_admin_user_proof_of_identity_refusal:
refusal: "Member's proof of identity <strong><em>%{NAME}</strong></em> refused."
notify_user_order_is_ready:
@ -435,8 +435,10 @@ de:
statistics:
subscriptions: "Abonnements"
machines_hours: "Maschinen-Slots"
machine_dates: "Slots dates"
space_dates: "Slots dates"
spaces: "Räume"
orders: "Orders"
orders: "Bestellungen"
trainings: "Schulungen"
events: "Veranstaltungen"
registrations: "Anmeldungen"
@ -453,6 +455,7 @@ de:
components: "Komponenten"
machines: "Maschinen"
user_id: "Nutzer-ID"
group: "Group"
bookings: "Buchungen"
hours_number: "Stundenzahl"
tickets_number: "Ticket Nummer"
@ -460,9 +463,9 @@ de:
account_creation: "Benutzerkontenerstellung"
project_publication: "Projektveröffentlichung"
duration: "Dauer"
store: "Store"
paid-processed: "Paid and/or processed"
aborted: "Aborted"
store: "Shop"
paid-processed: "Bezahlt und/oder bearbeitet"
aborted: "Abgebrochen"
#statistics exports to the Excel file format
export:
entries: "Einträge"
@ -478,7 +481,7 @@ de:
type: "Typ"
male: "Männlich"
female: "Weiblich"
deleted_user: "Deleted user"
deleted_user: "Gelöschte Benutzer"
#initial price's category for events, created to replace the old "reduced amount" property
price_category:
reduced_fare: "Ermäßigter Tarif"
@ -636,20 +639,20 @@ de:
overlapping_categories: "Kategorien zur Vorbeugung überlappender Buchungen"
extended_prices_in_same_day: "Erweiterte Preise am selben Tag"
public_registrations: "Öffentliche Registrierungen"
facebook: "facebook"
twitter: "twitter"
viadeo: "viadeo"
linkedin: "linkedin"
facebook: "Facebook"
twitter: "Twitter"
viadeo: "Viadeo"
linkedin: "LinkedIn"
instagram: "instagram"
youtube: "youtube"
vimeo: "vimeo"
dailymotion: "dailymotion"
github: "github"
youtube: "YouTube"
vimeo: "Vimeo"
dailymotion: "Dailymotion"
github: "Github"
echosciences: "echosciences"
pinterest: "pinterest"
lastfm: "lastfm"
flickr: "flickr"
machines_module: "Machines module"
pinterest: "Pinterest"
lastfm: "Lastfm"
flickr: "Flickr"
machines_module: "Maschinenmodul"
user_change_group: "Allow users to change their group"
show_username_in_admin_list: "Show the username in the admin's members list"
store_module: "Store module"

View File

@ -435,6 +435,8 @@ es:
statistics:
subscriptions: "Suscripciones"
machines_hours: "Machine slots"
machine_dates: "Slots dates"
space_dates: "Slots dates"
spaces: "Espacios"
orders: "Orders"
trainings: "Cursos"
@ -453,6 +455,7 @@ es:
components: "Componentes"
machines: "Máquinas"
user_id: "ID de usuario"
group: "Group"
bookings: "Reservas"
hours_number: "Número de horas"
tickets_number: "Número de entradas"

View File

@ -435,6 +435,8 @@ fr:
statistics:
subscriptions: "Abonnements"
machines_hours: "Créneaux machines"
machine_dates: "Date des créneaux"
space_dates: "Dates des créneaux"
spaces: "Espaces"
orders: "Commandes"
trainings: "Formations"
@ -453,6 +455,7 @@ fr:
components: "Composants"
machines: "Machines"
user_id: "ID Utilisateur"
group: "Groupe"
bookings: "Réservations"
hours_number: "Nombre d'heures"
tickets_number: "Nombre de places"

View File

@ -247,7 +247,7 @@ de:
category_members: "der Mitglieder"
click_to_view_results: "Klicken Sie hier, um die Ergebnisse anzuzeigen"
notify_admin_low_stock_threshold:
subject: "Low stock alert"
subject: "Warnung niedriger Bestand"
body:
low_stock: "A new stock movement of %{PRODUCT} has exceeded the low stock threshold."
stocks_state_html: "Current stock status: <ul><li>internal: %{INTERNAL}</li><li>external: %{EXTERNAL}</li></ul>"

View File

@ -435,6 +435,8 @@
statistics:
subscriptions: "Subscriptions"
machines_hours: "Machines slots"
machine_dates: "Slots dates"
space_dates: "Slots dates"
spaces: "Spaces"
orders: "Orders"
trainings: "Trainings"
@ -453,6 +455,7 @@
components: "Komponenter"
machines: "Maskiner"
user_id: "Bruker-ID"
group: "Group"
bookings: "Reservasjoner"
hours_number: "Timer nummer"
tickets_number: "Tickets number"

View File

@ -435,6 +435,8 @@ pt:
statistics:
subscriptions: "Assinaturas"
machines_hours: "Slots de máquina"
machine_dates: "Slots dates"
space_dates: "Slots dates"
spaces: "Espaços"
orders: "Orders"
trainings: "Treinamentos"
@ -453,6 +455,7 @@ pt:
components: "Componentes"
machines: "Máquinas"
user_id: "ID de usuário"
group: "Group"
bookings: "Reservas"
hours_number: "Número de horas"
tickets_number: "Número de vagas"

View File

@ -435,6 +435,8 @@ zu:
statistics:
subscriptions: "crwdns3689:0crwdne3689:0"
machines_hours: "crwdns4561:0crwdne4561:0"
machine_dates: "crwdns36787:0crwdne36787:0"
space_dates: "crwdns36789:0crwdne36789:0"
spaces: "crwdns3693:0crwdne3693:0"
orders: "crwdns31713:0crwdne31713:0"
trainings: "crwdns3695:0crwdne3695:0"
@ -453,6 +455,7 @@ zu:
components: "crwdns3721:0crwdne3721:0"
machines: "crwdns3723:0crwdne3723:0"
user_id: "crwdns3725:0crwdne3725:0"
group: "crwdns36791:0crwdne36791:0"
bookings: "crwdns3727:0crwdne3727:0"
hours_number: "crwdns3729:0crwdne3729:0"
tickets_number: "crwdns3731:0crwdne3731:0"

View File

@ -114,6 +114,17 @@ unless StatisticType.find_by(key: 'store', statistic_index_id: statistic_index_o
StatisticType.create!({ statistic_index_id: statistic_index_order.id, key: 'store', label: I18n.t('statistics.store'),
graph: true, simple: true })
end
Plan.find_each do |plan|
if plan.find_statistic_type.nil?
StatisticType.create!(
statistic_index_id: 1,
key: plan.duration.to_i,
label: "#{I18n.t('statistics.duration')} : #{plan.human_readable_duration}",
graph: true,
simple: true
)
end
end
# statistic_sub_types
unless StatisticSubType.find_by(key: 'created')
@ -131,6 +142,18 @@ end
unless StatisticSubType.find_by(key: 'aborted')
StatisticSubType.create!({ key: 'aborted', label: I18n.t('statistics.aborted'), statistic_types: statistic_index_order.statistic_types })
end
Plan.find_each do |plan|
type = plan.find_statistic_type
subtype = if StatisticSubType.find_by(key: plan.slug).nil?
plan.create_statistic_subtype
else
StatisticSubType.find_by(key: plan.slug)
end
if StatisticTypeSubType.find_by(statistic_type: type, statistic_sub_type: subtype).nil?
StatisticTypeSubType.create!(statistic_type: type, statistic_sub_type: subtype)
end
end
# statistic_graphs
StatisticGraph.create!({ statistic_index_id: 1, chart_type: 'stackedAreaChart', limit: 0 }) unless StatisticGraph.find_by(statistic_index_id: 1)

View File

@ -9,16 +9,18 @@ namespace :fablab do
create_stats_index
create_stats_mappings
add_event_filters
add_machine_filters
add_space_filters
end
def delete_stats_index
puts 'DELETE stats'
`curl -XDELETE http://#{ENV['ELASTICSEARCH_HOST']}:9200/stats`
`curl -XDELETE http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats`
end
def create_stats_index
puts 'PUT index stats'
`curl -XPUT http://#{ENV['ELASTICSEARCH_HOST']}:9200/stats -d'
`curl -XPUT http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats -d'
{
"settings" : {
"index" : {
@ -32,7 +34,7 @@ namespace :fablab do
def create_stats_mappings
%w[account event machine project subscription training user space].each do |stat|
puts "PUT Mapping stats/#{stat}"
`curl -XPUT http://#{ENV['ELASTICSEARCH_HOST']}:9200/stats/#{stat}/_mapping -d '
`curl -XPUT http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats/#{stat}/_mapping -d '
{
"properties": {
"type": {
@ -61,7 +63,7 @@ namespace :fablab do
end
def add_event_filters
`curl -XPUT http://#{ENV['ELASTICSEARCH_HOST']}:9200/stats/event/_mapping -d '
`curl -XPUT http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats/event/_mapping -d '
{
"properties": {
"ageRange": {
@ -76,10 +78,35 @@ namespace :fablab do
}';`
end
def add_machine_filters
`curl -XPUT http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats/machine/_mapping -d '
{
"properties": {
"machineDates": {
"properties": {
"type": "date",
}
}
}
}';`
end
def add_space_filters
`curl -XPUT http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats/space/_mapping -d '
{
"properties": {
"spaceDates": {
"properties": {
"type": "date",
}
}
}
}';`
end
desc 'add spaces reservations to statistics'
task add_spaces: :environment do
`curl -XPUT http://#{ENV['ELASTICSEARCH_HOST']}:9200/stats/space/_mapping -d '
`curl -XPUT http://#{ENV.fetch('ELASTICSEARCH_HOST')}:9200/stats/space/_mapping -d '
{
"properties": {
"type": {
@ -129,19 +156,18 @@ namespace :fablab do
end
else
puts "[ElasticSearch] An error occurred while creating #{Availability.index_name}/#{Availability.document_type}. " \
'Please check your ElasticSearch configuration.'
'Please check your ElasticSearch configuration.'
puts "\nCancelling..."
end
end
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) OR a date to generate statistics' unless args.period
unless Setting.get('statistics_module')
print 'Statistics are disabled. Do you still want to generate? (y/N) '
confirm = STDIN.gets.chomp
confirm = $stdin.gets.chomp
raise 'Interrupted by user' unless confirm == 'y'
end