-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: 765-part6
Are you sure you want to change the base?
Conversation
07734c7
to
d2aa52d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
c6146a0
to
d2aa52d
Compare
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.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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"]), |
There was a problem hiding this comment.
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] ?
1286377
to
506d51b
Compare
…ment and a specified session key
d2aa52d
to
dfefbaf
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…n is coded in upcoming PR
Issue #765
Description
🎸 Migrer
ForumRating
dansDocumentRating
🎸 Adapter la vue
htmx
Type de changement
🚧 technique
Points d'attention
🦺
ForumRating
est associé àrequest.session.session_key
. Si unForumRating
existe déjà,DocumentDetailView
affiche leForumRating
obtenu à la place des boutons d'évaluations.🦺 ajout de 2 annotations
count
etaverage
pour un rendu plus interessant (opportunité)🦺 suite #791
Captures d'écran (optionnel)
Avant votation
Après votation