diff --git a/meinberlin/apps/projects/filters.py b/meinberlin/apps/projects/filters.py index 906a2afd99..1e43f0256e 100644 --- a/meinberlin/apps/projects/filters.py +++ b/meinberlin/apps/projects/filters.py @@ -12,11 +12,13 @@ def filter_queryset(self, request, queryset, view): active_projects = queryset \ .filter( module__phase__start_date__lte=now, - module__phase__end_date__gt=now) \ + module__phase__end_date__gt=now, + module__is_draft=False) \ .distinct() future_projects = queryset.filter( - module__phase__start_date__gt=now + module__phase__start_date__gt=now, + module__is_draft=False ).distinct().exclude( id__in=active_projects.values('id')) @@ -28,7 +30,8 @@ def filter_queryset(self, request, queryset, view): if statustype == 'pastParticipation': past_projects = queryset.filter( - module__phase__end_date__lt=now + module__phase__end_date__lt=now, + module__is_draft=False ).distinct() \ .exclude( id__in=active_projects.values('id')) \ diff --git a/meinberlin/apps/projects/serializers.py b/meinberlin/apps/projects/serializers.py index 471084f06f..ad57d9c8b7 100644 --- a/meinberlin/apps/projects/serializers.py +++ b/meinberlin/apps/projects/serializers.py @@ -226,9 +226,9 @@ def seconds_in_units(self, seconds): return unit_totals def get_active_phase(self, instance): - progress = instance.active_phase_progress - time_left = instance.time_left - end_date = str(instance.active_phase_ends_next.end_date) + progress = instance.module_running_progress + time_left = instance.module_running_time_left + end_date = str(instance.running_module_ends_next.module_end) return [progress, time_left, end_date] def get_status(self, instance): @@ -252,7 +252,8 @@ class FutureProjectSerializer(ProjectSerializer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._future_phases = Phase.objects\ - .filter(start_date__gt=self.now)\ + .filter(start_date__gt=self.now, + module__is_draft=False)\ .order_by('start_date') def get_active_phase(self, instance): @@ -282,7 +283,8 @@ class PastProjectSerializer(ProjectSerializer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._past_phases = Phase.objects\ - .filter(end_date__lt=timezone.now())\ + .filter(end_date__lt=timezone.now(), + module__is_draft=False)\ .order_by('start_date') def get_active_phase(self, instance):