Coverage for rfpy/vendor/api/reports.py: 100%
15 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-29 13:25 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-29 13:25 +0000
1from typing import Annotated
3from rfpy.suxint import http
4from rfpy.api import fetch
5from rfpy.auth import perms
6from rfpy.web import serial
7from rfpy.vendor.validation import validate
10@http
11def get_issue_scoregaps(
12 session, effective_user, issue_id
13) -> Annotated[list[dict], list[serial.ScoreGaps]]:
14 issue = fetch.issue(session, issue_id)
15 validate(effective_user, issue, action=perms.ISSUE_VIEW_WINLOSS)
17 if issue.winloss_weightset_id is None:
18 weighting_set_id = 0
19 else:
20 weighting_set_id = issue.winloss_weightset_id
22 # Only show specific gap values if there are more than 2 scored respondents
23 # - possible to derive other vendor's scores if only two
24 show_gap_value = len(issue.project.scoreable_issues) > 2
26 return fetch.score_gaps(
27 issue,
28 weighting_set_id=weighting_set_id,
29 expose_weights=issue.project.expose_weightings,
30 show_gap_value=show_gap_value,
31 )