mirror of
https://git.hiabuto.net/C3MA/CCMA.git
synced 2026-08-25 15:05:18 +02:00
fix: tolerate damaged contribution files
This commit is contained in:
@@ -15,6 +15,7 @@ class RuleContext:
|
||||
today: date
|
||||
settings: Any
|
||||
repository_config: Mapping[str, Any]
|
||||
contributions_error: str | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
|
||||
@@ -7,6 +7,8 @@ ORDER = 50
|
||||
|
||||
|
||||
def evaluate(context: RuleContext):
|
||||
if context.contributions_error:
|
||||
return []
|
||||
actions = []
|
||||
for claim in context.contributions.claims:
|
||||
if str(claim.get("status", "open")) not in {"open", "partially_paid"}:
|
||||
|
||||
@@ -12,6 +12,8 @@ CENT = Decimal("0.01")
|
||||
|
||||
|
||||
def evaluate(context: RuleContext):
|
||||
if context.contributions_error:
|
||||
return []
|
||||
member = context.member
|
||||
if member.honorary or member.status not in CONTRIBUTION_STATUSES:
|
||||
return []
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
from ccma.rules.api import RuleContext, task
|
||||
|
||||
RULE_ID = "contributions-check"
|
||||
ORDER = 5
|
||||
|
||||
|
||||
def evaluate(context: RuleContext):
|
||||
if not context.contributions_error:
|
||||
return []
|
||||
return [
|
||||
task(
|
||||
rule_id=RULE_ID,
|
||||
member=context.member,
|
||||
key_suffix="invalid-file",
|
||||
severity="error",
|
||||
code="invalid_contributions_file",
|
||||
title=f"{context.member.display_name}: Beitragsdatei beschädigt",
|
||||
detail=(f"{context.contributions_error}. Die Datei wird nicht automatisch überschrieben."),
|
||||
)
|
||||
]
|
||||
Reference in New Issue
Block a user