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

refactor(documentation): partie 7, Rating, modèle, migration et vue #792

Open
wants to merge 10 commits into
base: 765-part6
Choose a base branch
from

Conversation

vincentporte
Copy link
Contributor

@vincentporte vincentporte commented Oct 1, 2024

Issue #765

Description

🎸 Migrer ForumRating dans DocumentRating
🎸 Adapter la vue htmx

Type de changement

🚧 technique

Points d'attention

🦺 ForumRating est associé à request.session.session_key. Si un ForumRating existe déjà, DocumentDetailView affiche le ForumRating obtenu à la place des boutons d'évaluations.
🦺 ajout de 2 annotations count et average pour un rendu plus interessant (opportunité)
🦺 suite #791

Captures d'écran (optionnel)

Avant votation

image

Après votation

image

Copy link
Contributor

@hellodeloo hellodeloo left a comment

Choose a reason for hiding this comment

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

LGTM

response = client.post(url, data={"rating": 5})
assert response.status_code == 200
assert response.context["count"] == 6
assert response.context["average"] == 3

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, trop rapide. J’avais pas vu le post qui en créait un supplémentaire.

document=get_object_or_404(Document, pk=self.kwargs["pk"]),
user=request.user if request.user.is_authenticated else None,
rating=int(request.POST["rating"]),
session_id=request.session.session_key,
Copy link
Contributor

Choose a reason for hiding this comment

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

C’est pas nouveau, mais facile de pourrir vos stats 😇

document_rating = DocumentRating.objects.create(
document=get_object_or_404(Document, pk=self.kwargs["pk"]),
user=request.user if request.user.is_authenticated else None,
rating=int(request.POST["rating"]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Est-ce qu’on ne voudrait pas au moins contrôler que c’est dans l’intervalle [0-5] ?

@vincentporte
Copy link
Contributor Author

⚠️ DocumentStatView, lien inexistant dans la requete forum/document x stats/rating : TO BE FIXED

Copy link
Contributor

@hellodeloo hellodeloo left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code technical debt templating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants