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

PASS IAE: Affichage de l'estimation de durée restante [GEN-228] #4434

Merged
merged 2 commits into from
Jul 16, 2024

Conversation

tonial
Copy link
Contributor

@tonial tonial commented Jul 16, 2024

🤔 Pourquoi ?

C'est plus facile à comprendre que "571 jours"

🍰 Comment ?

Décrivez en quelques mots la solution retenue et mise en oeuvre, les difficultés ou problèmes rencontrés. Attirez l'attention sur les décisions d'architecture ou de conception importantes.

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?

🏝️ Comment tester

Les instructions pour reproduire le problème, les profils de test, le parcours spécifique à utiliser, etc. Si vous disposez d'une recette jetable, mettre l'URL pour tester dans cette partie.

💻 Captures d'écran

@tonial tonial requested review from xavfernandez and rsebille July 16, 2024 08:01
@tonial tonial self-assigned this Jul 16, 2024
Copy link
Contributor

@xavfernandez xavfernandez left a comment

Choose a reason for hiding this comment

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

💯 👍

tests/approvals/tests.py Show resolved Hide resolved
@tonial tonial force-pushed the alaurent/approval_remainder branch from e4e538d to 8433b9c Compare July 16, 2024 08:37
@tonial tonial force-pushed the alaurent/approval_remainder branch from 8433b9c to d7aa909 Compare July 16, 2024 08:38
@tonial tonial added this pull request to the merge queue Jul 16, 2024
Merged via the queue into master with commit 93eac79 Jul 16, 2024
11 checks passed
@tonial tonial deleted the alaurent/approval_remainder branch July 16, 2024 09:46
Comment on lines +138 to +159
def _get_human_readable_estimate(self, days):
split = []
years = days // 365
if years:
split.append(f"{years} an{pluralizefr(years)}")
days = days % 365
months = days // 30
if months:
split.append(f"{months} mois")
if years:
return "Environ " + " et ".join(split)
days = days % 30
weeks = days // 7
if weeks:
split.append(f"{weeks} semaine{pluralizefr(weeks)}")
if months:
return "Environ " + " et ".join(split)
days = days % 7
if days:
split.append(f"{days} jour{pluralizefr(days)}")
return " et ".join(split)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ça m'a fait penser au filtre Django timeuntil mais je pense qu'utiliser la fonction sous-jacente est encore mieux : https://github.com/django/django/blob/5dc17177c38662d6f4408258ee117cd80e0cb933/django/utils/timesince.py#L138-L142

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Trop bien, je vais essayer de l'utiliser à la place.
J'ai juste un doute sur le "Environ" à mettre devant 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants