Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETQ instructeur, j'ai besoin d'un accès très facile à mondernier export #9855

Merged
merged 6 commits into from
Dec 20, 2023

Conversation

lisa-durand
Copy link
Contributor

closes #9736

Capture d’écran 2023-12-14 à 10 45 49

@lisa-durand lisa-durand marked this pull request as ready for review December 18, 2023 13:11
@lisa-durand lisa-durand requested a review from colinux December 18, 2023 13:12
Copy link
Member

@colinux colinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour le bug sur les exports en échec: je pense que ça vient du fait que le poll appelle download_export qui fait un .find_or_create_fresh_export, qui finit par un create car le dernier export a été en échec. Ce qui veut dire qu'en l'état, on créé un nouvel export dès le premier poll, et le last_export renvoyé est donc en pending

Comment on lines 384 to 388
export = Export.where(instructeur_id: current_instructeur.id, statut: statut).last
if export.present?
return nil if export.updated_at < 1.hour.ago
end
export
Copy link
Member

@colinux colinux Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

petite simplification :

Suggested change
export = Export.where(instructeur_id: current_instructeur.id, statut: statut).last
if export.present?
return nil if export.updated_at < 1.hour.ago
end
export
Export.where(instructeur_id: current_instructeur.id, statut: statut, updated_at: 1.hour.ago..).last

@lisa-durand lisa-durand force-pushed the display-last-export-in-same-page-ldu branch 2 times, most recently from 9d10a4a to d948009 Compare December 19, 2023 14:19
Copy link
Member

@colinux colinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dernier petit truc, pour le reste ça me paraît OK!

@@ -0,0 +1,11 @@
- if export.present?
%div{ data: export.pending? ? { controller: "turbo-poll", turbo_poll_url_value: polling_last_export_instructeur_procedure_path(export_format: export.format, statut: @statut), turbo_poll_interval_value: 5_000, turbo_poll_max_checks_value: 6 } : {} }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je l'avais pas vue avant, mais dans ce partial utilise une variable d'instance @statut. Comme pour l'export ce serait mieux de la passer en variable locale

@@ -6,3 +6,6 @@
- else
= turbo_stream.update_all '.dossiers-export' do
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path))

= turbo_stream.update "last-export-alert" do
= render partial: "last_export_alert", locals: {export: @last_export}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vu que tu vas modifier les locals, il manque les espaces autour des {}(d'ailleurs en principe haml-lint est censé les voir ?)

@lisa-durand lisa-durand force-pushed the display-last-export-in-same-page-ldu branch from d948009 to 3e79278 Compare December 19, 2023 15:49
@lisa-durand lisa-durand force-pushed the display-last-export-in-same-page-ldu branch from 3e79278 to e6a4459 Compare December 19, 2023 15:54
@lisa-durand lisa-durand added this pull request to the merge queue Dec 20, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 20, 2023
@lisa-durand lisa-durand added this pull request to the merge queue Dec 20, 2023
Merged via the queue into main with commit e52bd9d Dec 20, 2023
15 checks passed
@lisa-durand lisa-durand deleted the display-last-export-in-same-page-ldu branch December 20, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ETQ instructeur, j'ai besoin d'un accès très facile à mon / mes derniers exports
2 participants