mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
export events availabilities
This commit is contained in:
parent
056060a88d
commit
c21f7ed5dc
@ -40,7 +40,7 @@ wb.add_worksheet(name: t('export_availabilities.machines')) do |sheet|
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
## Trainings slots
|
## Trainings availabilities
|
||||||
wb.add_worksheet(name: t('export_availabilities.trainings')) do |sheet|
|
wb.add_worksheet(name: t('export_availabilities.trainings')) do |sheet|
|
||||||
|
|
||||||
## data table
|
## data table
|
||||||
@ -96,4 +96,30 @@ if Rails.application.secrets.fablab_without_spaces != 'false'
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
## Events availabilities
|
||||||
|
wb.add_worksheet(name: t('export_availabilities.events')) do |sheet|
|
||||||
|
|
||||||
|
## data table
|
||||||
|
# heading labels
|
||||||
|
columns = [t('export_availabilities.date'), t('export_availabilities.slot'), t('export_availabilities.event'),
|
||||||
|
t('export_availabilities.reservations'), t('export_availabilities.available_seats')]
|
||||||
|
sheet.add_row columns, :style => header
|
||||||
|
|
||||||
|
# data rows
|
||||||
|
@availabilities.where(available_type: 'event').order(:start_at).each do |a|
|
||||||
|
data = [
|
||||||
|
a.start_at.to_date,
|
||||||
|
print_slot(a.start_at, a.end_at),
|
||||||
|
a.event.title,
|
||||||
|
a.reservations.map(&:nb_reserve_places).reduce(:+) || 0,
|
||||||
|
a.nb_total_places
|
||||||
|
]
|
||||||
|
styles = [date, nil, nil, nil, nil]
|
||||||
|
types = [:date, :string, :string, :integer, :integer]
|
||||||
|
|
||||||
|
sheet.add_row data, :style => styles, :types => types
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -197,6 +197,7 @@ en:
|
|||||||
machine: "Machine"
|
machine: "Machine"
|
||||||
training: "Training"
|
training: "Training"
|
||||||
space: "Space"
|
space: "Space"
|
||||||
|
event: "Event"
|
||||||
reservations: "Reservations"
|
reservations: "Reservations"
|
||||||
available_seats: "Available seats"
|
available_seats: "Available seats"
|
||||||
|
|
||||||
|
@ -197,6 +197,7 @@ fr:
|
|||||||
machine: "Machine"
|
machine: "Machine"
|
||||||
training: "Formation"
|
training: "Formation"
|
||||||
space: "Espace"
|
space: "Espace"
|
||||||
|
event: "Évènement"
|
||||||
reservations: "Réservations"
|
reservations: "Réservations"
|
||||||
available_seats: "Places disponibles"
|
available_seats: "Places disponibles"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user