|
|
|
|
@ -1282,10 +1282,10 @@ class Freizeit(CommonModel):
|
|
|
|
|
@property
|
|
|
|
|
def total_seminar_days(self):
|
|
|
|
|
"""calculate seminar days based on intervention hours in every day"""
|
|
|
|
|
# TODO: add tests for this
|
|
|
|
|
if hasattr(self, 'ljpproposal'):
|
|
|
|
|
hours_per_day = (
|
|
|
|
|
Intervention.objects
|
|
|
|
|
.filter(ljp_proposal_id=self.ljpproposal.id)
|
|
|
|
|
self.ljpproposal.intervention_set
|
|
|
|
|
.annotate(day=TruncDate('date_start')) # Extract the date (without time)
|
|
|
|
|
.values('day') # Group by day
|
|
|
|
|
.annotate(total_duration=Sum('duration')) # Sum durations for each day
|
|
|
|
|
|