• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

EQAR / eqar_backend / a64b4c3c-256c-4415-b1b3-0ccc97c9db7d

12 Apr 2026 10:12PM UTC coverage: 86.337% (+0.2%) from 86.129%
a64b4c3c-256c-4415-b1b3-0ccc97c9db7d

push

circleci

JoshBone
Added validation for report validity dates against activity dates.

65 of 67 new or added lines in 5 files covered. (97.01%)

9877 of 11440 relevant lines covered (86.34%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/reports/validations.py
1
import datetime
1✔
2

3

4
def _to_date(value):
1✔
5
    if isinstance(value, datetime.datetime):
1✔
6
        return value.date()
1✔
7
    return value
1✔
8

9

10
def validate_report_dates_within_activity_windows(activities, valid_from, valid_to=None):
1✔
11
    errors = []
1✔
12
    valid_from = _to_date(valid_from)
1✔
13
    valid_to = _to_date(valid_to)
1✔
14

15
    for activity in activities:
1✔
16
        activity_start = _to_date(activity.activity_valid_from)
1✔
17
        activity_end = _to_date(activity.activity_valid_to or activity.agency.registration_valid_to)
1✔
18

19
        has_from_error = valid_from < activity_start or (activity_end and valid_from > activity_end)
1✔
20
        has_to_error = valid_to and (valid_to < activity_start or (activity_end and valid_to > activity_end))
1✔
21

22
        if has_from_error or has_to_error:
1✔
23
            if activity_end:
1✔
24
                period = f"{activity_start} to {activity_end}"
1✔
25
            else:
NEW
26
                period = f"{activity_start} onward"
×
27

28
            errors.append(
1✔
29
                f"Report validity dates must fall within the assigned activity validity period "
30
                f"(activity #{activity.id}: {period})."
31
            )
32

33
    return errors
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc