Conversation
There was a problem hiding this comment.
The shift detail page already has a lot of information, I don't think we should add more, especially if they are not relevant for everyday use.
I would either make a separate page for shift stats, or maybe add a button to the header with just the stats icon (material-icon calculate) that shows a popup or a tooltip.
Also we'll need tests.
fa843d0 to
97634eb
Compare
Theophile-Madet
left a comment
There was a problem hiding this comment.
- Should we show the same stats on the shift template detail page?
- Can you try to check the amount of DB requests this creates when there are a lot of past shifts? I added a comment on
tapir/shifts/views/views.py. Let me know if you need help with Silk or how to useselected_relatedandprefetch_related. - The main stats page is intended as an overview of the key stats to reach the break-even. We removed all other stats on purpose to keep the overview clear, I think it should stay as it is. We could rename the current page to "Stats for break-even" or "Key stats" and add another one called "secondary stats"? There are a few stats from the old member stats page that we removed for clarity and because they are untested, but we could move them to a secondary stats page later.
433d8f5 to
857aa04
Compare
|
Hey,
|
Theophile-Madet
left a comment
There was a problem hiding this comment.
A few more style suggestions but I think we're getting there.
2361c82 to
df4a345
Compare
|
@Theophile-Madet , thanks for your feedback. I really try to comply with the test-naming-style-guide, but keep forgetting sorry. |
|
Are the force push always needed? After a force push I can't use the "show differences since last review" feature. |
No, of course not. I just do rebases to update the PRs but if we squash before merge I think I don't have to |
| ) | ||
|
|
||
| context = ShiftDetailView.get_past_shifts_data(shift_template) | ||
| self.assertAlmostEqual(context["total_hours"], 7.0) |
There was a problem hiding this comment.
I think this can just be a normal self.assertEqual? Is there a reason for using assertAlmostEqual?
There was a problem hiding this comment.
Floating-point numbers, you know. The print(0.1+0.2 == 0.3) giving False.
There was a problem hiding this comment.
https://stackoverflow.com/a/33199669 Some "evidence"
There was a problem hiding this comment.
But have you actually had that problem here?
There was a problem hiding this comment.
No, but I would say it's good practice preventing problems
tapir/shifts/templatetags/shifts.py
Outdated
|
|
||
| @register.simple_tag | ||
| def random_shift_text(total_hours, no_of_past_shifts, first_shift_date): | ||
| texts = [ |
There was a problem hiding this comment.
I'm not sure I understand the point of this, is it not all the same sentence but formulated slightly differently?
There was a problem hiding this comment.
I didn't like any text so I thought it would be nice if they change from time to time.
There was a problem hiding this comment.
but I'm also not fighting for this feature
There was a problem hiding this comment.
Then I'd remove it, otherwise it's not clear why it's here.
Co-authored-by: Théophile MADET <theo.madet@posteo.net>
Co-authored-by: Théophile MADET <theo.madet@posteo.net>
# Conflicts: # tapir/translations/locale/de/LC_MESSAGES/django.po
tapir/shifts/templatetags/shifts.py
Outdated
|
|
||
| @register.simple_tag | ||
| def random_shift_text(total_hours, no_of_past_shifts, first_shift_date): | ||
| texts = [ |
There was a problem hiding this comment.
Then I'd remove it, otherwise it's not clear why it's here.
# Conflicts: # tapir/translations/locale/de/LC_MESSAGES/django.po
mh, it's gone idk. But I leave if it it's okay since the typing is also in other files. It was something like "ShiftFactory does not have slots" |
# Conflicts: # tapir/translations/locale/de/LC_MESSAGES/django.po
# Conflicts: # tapir/translations/locale/de/LC_MESSAGES/django.po
Resolves #407 .
Simple markup but I think currently sufficient. Let me know if you see it somewhere else...