Skip to content

Commit

Permalink
⚡️ Réduit le temps de chargement de la situation place du marché
Browse files Browse the repository at this point in the history
En retournant directement les URL des SVG

Car sinon le serveur télécharger un à un les fichiers SVG, ce qui donner un temps de chargement de >10s pour l'api de détail d'une campagne
  • Loading branch information
cprodhomme committed Jan 21, 2025
1 parent 12e1407 commit c8c388b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/question_clic_dans_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QuestionClicDansImage < Question

def as_json(_options = nil)
json = base_json
json['image_au_clic'] = cdn_for(image_au_clic) if image_au_clic.attached?
json['image_au_clic_url'] = cdn_for(image_au_clic) if image_au_clic.attached?
json.merge!(json_audio_fields, additional_json_fields)
end

Expand Down Expand Up @@ -52,7 +52,7 @@ def base_json
json['type'] = 'clic-dans-image'
json['illustration'] = cdn_for(illustration) if illustration.attached?
json['description'] = description
json['zone_cliquable'] = cdn_for(zone_cliquable) if zone_cliquable.attached?
json['zone_cliquable_url'] = cdn_for(zone_cliquable) if zone_cliquable.attached?
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/models/question_clic_dans_image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
intitule.audio
))
expect(json['modalite_reponse']).to eql(modalite.ecrit)
expect(json['zone_cliquable']).to start_with('http://')
expect(json['image_au_clic']).to start_with('http://')
expect(json['zone_cliquable_url']).to start_with('http://')
expect(json['image_au_clic_url']).to start_with('http://')
end
end

Expand Down

0 comments on commit c8c388b

Please sign in to comment.