-
Notifications
You must be signed in to change notification settings - Fork 3
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
✨ [#183] added afgehandeld_op field for internetaken #185
Conversation
3257edc
to
d02cf9b
Compare
src/openklant/components/klantinteracties/admin/internetaken.py
Outdated
Show resolved
Hide resolved
src/openklant/components/klantinteracties/api/serializers/internetaken.py
Outdated
Show resolved
Hide resolved
src/openklant/components/klantinteracties/api/serializers/internetaken.py
Outdated
Show resolved
Hide resolved
|
||
validated_data["actor"] = Actor.objects.get(uuid=actor_uuid) | ||
validated_data["klantcontact"] = Klantcontact.objects.get( | ||
uuid=klantcontact_uuid | ||
) | ||
|
||
if validated_data.get("status") == Taakstatus.verwerkt: | ||
validated_data["afgehandeld_op"] = afgehandeld_op |
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.
Is it necessary to implement this in the serializer .create
and .update
? I think it would be easier to implement it in the InterneTaak
model .save
.
I think since afgehandeldOp
is a field for which the value is always now()
or None
, it should probably be a read-only field on the serializer, that way you can remove the .validate
and the changes in .create
and .update
and leave the logic in InterneTaak.save
as is
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.
Voor afgehandeldOp
we want the user to either provide a value or user the date when the request was made. Hence why we shouldn't set the field as read_only. We can definitely set the value if none provided in the model .save
method.
2384355
to
2199b1a
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.
Some minor suggestions to but looks good.
src/openklant/components/klantinteracties/models/internetaken.py
Outdated
Show resolved
Hide resolved
src/openklant/components/klantinteracties/api/serializers/internetaken.py
Outdated
Show resolved
Hide resolved
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.
Looks good, the final comment about the error message is not super critical, but I think it would be good to keep it in line with the conditional
…ore precise in checking for status
d9ff5ca
to
2a0483e
Compare
Fixes #183
afgehandeld_op
field forinternetaken
afgehandeld_op
when status is set onverwerkt
afgehandeld_op
when status is set back onte_verwerken
ifafgehandeld_op
already had a date