diff --git a/hypha/apply/funds/tests/test_views.py b/hypha/apply/funds/tests/test_views.py index 3908abf8e2e61e284ed1cd6560c64d8201534f30..5e5bd2cea53ed4486aedd4cb274fb3bfda88d8fb 100644 --- a/hypha/apply/funds/tests/test_views.py +++ b/hypha/apply/funds/tests/test_views.py @@ -176,9 +176,9 @@ class TestStaffSubmissionView(BaseSubmissionViewTestCase): self.assertEqual(new_title, submission.title) def test_not_included_fields_render(self): - submission = ApplicationSubmissionFactory(form_fields__exclude__value=True) + submission = ApplicationSubmissionFactory(form_fields__exclude__checkbox=True) response = self.get_page(submission) - self.assertNotContains(response, 'Value') + self.assertNotContains(response, 'check_one') def test_can_screen_submission(self): screening_outcome = ScreeningStatusFactory() diff --git a/hypha/apply/projects/models.py b/hypha/apply/projects/models.py index 17752047112383f2ce032da28a4b299c479b354e..0acbf9a80fcd75b098b7ef72014721bdc5ca7a84 100644 --- a/hypha/apply/projects/models.py +++ b/hypha/apply/projects/models.py @@ -651,8 +651,14 @@ class ReportConfig(models.Model): def last_report(self): today = timezone.now().date() + # Get the most recent report that was either: + # - due by today and not submitted + # - was skipped but due after today + # - was submitted but due after today return self.project.reports.filter( - Q(end_date__lt=today) | Q(skipped=True) + Q(end_date__lt=today) | + Q(skipped=True) | + Q(submitted__isnull=False) ).first() def current_due_report(self): diff --git a/hypha/apply/projects/tests/test_commands.py b/hypha/apply/projects/tests/test_commands.py index 685162fe7c85d3503ca2931f9cfc152ff02b8b95..e3b8852886840e943cff34558a175a8d68e1fb85 100644 --- a/hypha/apply/projects/tests/test_commands.py +++ b/hypha/apply/projects/tests/test_commands.py @@ -30,7 +30,8 @@ class TestNotifyReportDue(TestCase): end_date=config.schedule_start, ) out = StringIO() - call_command('notify_report_due', 7, stdout=out) + with self.settings(ALLOWED_HOSTS=[ApplyHomePage.objects.first().get_site().hostname]): + call_command('notify_report_due', 7, stdout=out) self.assertNotIn('Notified project', out.getvalue()) def test_dont_notify_already_notified(self): diff --git a/hypha/apply/stream_forms/testing/factories.py b/hypha/apply/stream_forms/testing/factories.py index 49d7c5bfc0624606b4ce67604be43418dbf354bc..8a705b5eaf61b71effab312e8e07e9986d97789d 100644 --- a/hypha/apply/stream_forms/testing/factories.py +++ b/hypha/apply/stream_forms/testing/factories.py @@ -179,7 +179,7 @@ class CheckboxFieldBlockFactory(FormFieldBlockFactory): class CheckboxesFieldBlockFactory(FormFieldBlockFactory): - checkboxes = ['check_one', 'check_two', 'check_three'] + checkboxes = ['check_multiple_one', 'check_multiple_two', 'check_multiple_three'] class Meta: model = stream_blocks.CheckboxesFieldBlock