mirror of https://github.com/snachodog/mybuddy.git
Consider last-feeding-method as empty if never-changing
If the feeding method is always the same, the last-feeding-method card is unhelpful. Consider it "empty" so it can be hidden by user setting. This is an alternative solution to https://github.com/babybuddy/babybuddy/issues/139.
This commit is contained in:
parent
20538ce59d
commit
9d2e539fc4
|
@ -159,7 +159,8 @@ def card_feeding_last_method(context, child):
|
||||||
instances = models.Feeding.objects.filter(child=child) \
|
instances = models.Feeding.objects.filter(child=child) \
|
||||||
.filter(**_filter_data_age(context)) \
|
.filter(**_filter_data_age(context)) \
|
||||||
.order_by('-end')[:3]
|
.order_by('-end')[:3]
|
||||||
empty = len(instances) == 0
|
num_unique_methods = len({i.method for i in instances})
|
||||||
|
empty = num_unique_methods <= 1
|
||||||
|
|
||||||
# Results are reversed for carousel forward/back behavior.
|
# Results are reversed for carousel forward/back behavior.
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue