fix(types): resolucion integral de tipado estatico, Pyright 0 errores y bump a v3.8.1
This commit is contained in:
@@ -56,17 +56,21 @@ class MilestoneGrade(db.Model):
|
||||
@property
|
||||
def is_passed(self) -> bool:
|
||||
"""Determina si la nota está aprobada (>= 4.00 y no ausente)."""
|
||||
if self.is_absent or self.score is None:
|
||||
if getattr(self, 'is_absent', False):
|
||||
return False
|
||||
return bool(float(self.score) >= 4.0)
|
||||
score_val = getattr(self, 'score', None)
|
||||
if score_val is None:
|
||||
return False
|
||||
return float(score_val) >= 4.0
|
||||
|
||||
@property
|
||||
def display_score(self) -> str:
|
||||
"""Representación textual estándar: 'Ausente', '7.5' o '-'."""
|
||||
if self.is_absent:
|
||||
if getattr(self, 'is_absent', False):
|
||||
return 'Ausente'
|
||||
if self.score is not None:
|
||||
val = float(self.score)
|
||||
score_val = getattr(self, 'score', None)
|
||||
if score_val is not None:
|
||||
val = float(score_val)
|
||||
return f'{val:.1f}' if val % 1 != 0 else f'{int(val)}'
|
||||
return '-'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user