1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

export trainings availabilities

This commit is contained in:
Sylvain 2017-03-02 12:44:59 +01:00
parent 504fe49964
commit d9b30fa2b0
3 changed files with 30 additions and 0 deletions

View File

@ -37,4 +37,30 @@ wb.add_worksheet(name: t('export_availabilities.machines')) do |sheet|
end
end
end
end
## Trainings slots
wb.add_worksheet(name: t('export_availabilities.trainings')) do |sheet|
## data table
# heading labels
columns = [t('export_availabilities.date'), t('export_availabilities.slot'), t('export_availabilities.training'),
t('export_availabilities.reservations'), t('export_availabilities.available_seats')]
sheet.add_row columns, :style => header
# data rows
@availabilities.where(available_type: 'training').order(:start_at).each do |a|
data = [
a.start_at.to_date,
print_slot(a.start_at, a.end_at),
a.trainings.first.name,
a.reservations.count,
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

View File

@ -195,7 +195,9 @@ en:
date: "Date"
slot: "Slot"
machine: "Machine"
training: "Training"
reservations: "Reservations"
available_seats: "Available seats"
api:

View File

@ -195,7 +195,9 @@ fr:
date: "Date"
slot: "Créneau"
machine: "Machine"
training: "Formation"
reservations: "Réservations"
available_seats: "Places disponibles"
api: