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

djbrown / hbscorez / 26069213721

19 May 2026 12:47AM UTC coverage: 46.477% (-0.004%) from 46.481%
26069213721

push

github

djbrown
route by pk (id) instead of bhv_id

49 of 224 branches covered (21.88%)

Branch coverage included in aggregate %.

36 of 67 new or added lines in 17 files covered. (53.73%)

7 existing lines in 4 files now uncovered.

1699 of 3537 relevant lines covered (48.04%)

0.48 hits per line

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

23.08
/src/api/views.py
1
from django.http import JsonResponse
1✔
2

3
from associations.models import Association
1✔
4
from districts.models import District
1✔
5
from leagues.models import League, Season
1✔
6

7

8
def associations(_):
1✔
9
    light_associations = [
×
10
        {
11
            "pk": a.pk,
12
            "name": a.name,
13
            "abbreviation": a.abbreviation,
14
        }
15
        for a in Association.objects.all()
16
    ]
17

18
    return JsonResponse({"associations": light_associations})
×
19

20

21
def association_districts(_, pk):
1✔
NEW
22
    association_results = Association.objects.filter(pk=pk)
×
23

24
    if not association_results.exists():
×
25
        return JsonResponse({"error": "No matching Association found."}, status=404)
×
26

27
    association = association_results[0]
×
28

29
    districts = [
×
30
        {
31
            "pk": district.pk,
32
            "name": district.name,
33
        }
34
        for district in association.district_set.all()
35
    ]
36

37
    return JsonResponse({"districts": districts})
×
38

39

40
def seasons(_):
1✔
41
    light_seasons = [{"startYear": season.start_year} for season in Season.objects.all()]
×
42

43
    return JsonResponse({"seasons": light_seasons})
×
44

45

46
def district_season_leagues(_, pk, start_year):
1✔
NEW
47
    district_results = District.objects.filter(pk=pk)
×
48
    if not district_results.exists():
×
49
        return JsonResponse({"error": "No matching District found."}, status=404)
×
50
    district = district_results[0]
×
51

52
    season_results = Season.objects.filter(start_year=start_year)
×
53
    if not season_results.exists():
×
54
        return JsonResponse({"error": "No matching Season found."}, status=404)
×
55
    season = season_results[0]
×
56

57
    light_leagues = [
×
58
        {
59
            "pk": league.pk,
60
            "name": league.name,
61
        }
62
        for league in League.objects.filter(district=district, season=season)
63
    ]
64

65
    return JsonResponse({"leagues": light_leagues})
×
66

67

68
def league_teams(_, pk):
1✔
NEW
69
    leagues = League.objects.filter(pk=pk)
×
70

71
    if not leagues.exists():
×
72
        return JsonResponse({"error": "No matching League found."}, status=404)
×
73

74
    league = leagues[0]
×
75

76
    light_teams = [
×
77
        {
78
            "pk": team.pk,
79
            "name": team.name,
80
            "shortName": team.short_name,
81
        }
82
        for team in league.team_set.all()
83
    ]
84

85
    return JsonResponse({"teams": light_teams})
×
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