Improuve export UI

This commit is contained in:
Paul Chavard 2021-04-08 11:47:29 +01:00
parent a88f780252
commit 651a928b7c
4 changed files with 26 additions and 6 deletions

View file

@ -9,7 +9,7 @@
# updated_at :datetime not null
#
class Export < ApplicationRecord
MAX_DUREE_CONSERVATION_EXPORT = 1.hour
MAX_DUREE_CONSERVATION_EXPORT = 3.hours
enum format: {
csv: 'csv',
@ -45,6 +45,10 @@ class Export < ApplicationRecord
file.attached?
end
def old?
updated_at < 20.minutes.ago
end
def self.find_or_create_export(format, groupe_instructeurs)
create_with(groupe_instructeurs: groupe_instructeurs)
.create_or_find_by(format: format, key: generate_cache_key(groupe_instructeurs))