-
Notifications
You must be signed in to change notification settings - Fork 10
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
allow multiple comments per participation #1457
base: main
Are you sure you want to change the base?
Conversation
eae8cbe
to
a30d7ba
Compare
ephios/core/templates/core/disposition/fragment_participation.html
Outdated
Show resolved
Hide resolved
44606ba
to
16dfe9d
Compare
@felixrindt I played around with the state change stuff a bit. |
ephios/core/templates/core/disposition/fragment_participation.html
Outdated
Show resolved
Hide resolved
def save(self): | ||
with transaction.atomic(): | ||
result = super().save() | ||
if comment := self.cleaned_data["comment"]: | ||
ParticipationComment.objects.create( | ||
participation=result, | ||
text=comment, | ||
authored_by_responsible=self.acting_user, | ||
visibile_for=self.get_comment_visibility(), | ||
) | ||
return result |
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.
You can use @transaction.atomic()
as a decorator iirc
if not self.errors: | ||
start = cleaned_data["individual_start_time"] or self.shift.start_time | ||
end = cleaned_data["individual_end_time"] or self.shift.end_time | ||
if end < start: | ||
self.add_error("individual_end_time", _("End time must not be before start time.")) | ||
return cleaned_data | ||
|
||
def save(self): |
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.
hmm we can't remove the commit parameter here, as e.g. the named teams Participation Form calls save with the commit parameter. I actually ran into the exception while testing.
<p class="mt-0 mb-0 d-flex"> | ||
<span class="pe-1"><b>{{ comment.author }}</b></span> | ||
<span class="flex-grow-1">{{ comment.text }}</span> | ||
<span>{% blocktranslate trimmed with comment.created_at|timesince as time %}{{ time }} ago{% endblocktranslate %}</span> |
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.
I tried to translate this to german and it said "vor 5 Tage, 23 Stunde" and I didn't like that. "5 Tage, 23 Stunden her" könnte eher gehen.
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.
klingt halt seeeehr informell
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.
Gefällt mir auch nicht... Wie ist das denn bei dem Meldeschluss gelöst?
{% load i18n %} | ||
<div> | ||
{% for comment in comments %} | ||
<p class="mt-0 mb-0 d-flex"> |
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.
I think when displaying comments, the need some kind of indicator who can see them. When doing the disposition, I might think a user can see a comment I wrote 5 days ago, even though I might have checked the box to hide it from them :/
{{ form.comment.label_tag }} | ||
<span class="float-end form-check"> | ||
<input type="checkbox" id="{{ form.comment_is_internal.auto_id }}" name="{{ form.comment_is_internal.html_name }}" class="form-check-input"> | ||
{{ form.comment_is_internal.label_tag }} |
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.
<i class="fas fa-comment"></i> | ||
<div class="d-inline"> | ||
<span><b>{{ comment.author }}</b></span><br /> | ||
<span>{{ comment.text }}</span> |
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.
again, I'm missing some kind of indication who can see what. That might be more of a design issue then a coding challenge. I thought about using font weight and color or words like "to you", "to everyone", "to responsibles" to indicate receivers of the comment/message
def revert_comments(apps, schema_editor): | ||
ParticipationComment = apps.get_model("core", "ParticipationComment") | ||
db_alias = schema_editor.connection.alias | ||
for comment in ParticipationComment.objects.using(db_alias).all(): | ||
comment.participation.comment = comment.text | ||
comment.participation.save() |
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.
Bonus points for building the reverse method. Do we need the db_alias here?
closes #230 closes #1214
ToDo