++ fix prioritario display and add link sent toggle

This commit is contained in:
2026-04-13 15:40:35 +00:00
parent 0553d4ef74
commit 6a65087449
10 changed files with 459 additions and 108 deletions

View File

@@ -72,19 +72,19 @@ class Campagna extends Model
/**
* Campaign coverage percentage.
* Numerator: assignments counted for campaign
* Denominator: ALL assignments with assigned_at in campaign range (returned or not)
* Denominator: total active territories
*/
public function getPercentualePercorrenzaAttribute(): float
{
$totaleNelRange = $this->assegnazioniNelRange()->count();
$totaleAttivi = Territorio::where('attivo', true)->count();
if ($totaleNelRange === 0) {
if ($totaleAttivi === 0) {
return 0.0;
}
$conteggiate = $this->assegnazioniConteggiate()->count();
return round(($conteggiate / $totaleNelRange) * 100, 1);
return round(($conteggiate / $totaleAttivi) * 100, 1);
}
public function scopeCompletate($query)