++ fix statistiche campagne
- Dettaglio campagna: mostra tutti i territori conteggiati (stessa base della percentuale), non solo quelli assegnati dopo l'inizio. - Rientro: se più campagne corrispondono propone la più recente invece della prima creata; testo del banner chiarito. - Dettaglio campagna: nuova sezione "In corso" con i territori fuori durante la campagna e non ancora rientrati. - README: regola di conteggio documentata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,18 @@ class CampagnaShow extends Component
|
||||
->orderBy('returned_at')
|
||||
->get();
|
||||
|
||||
// Open assignments can still be counted for this campaign only while
|
||||
// no later campaign has started: on return the most recent one is
|
||||
// offered (see Assegnazione::campagnaApplicabile()).
|
||||
$superata = Campagna::where('start_date', '>', $this->campagna->start_date)
|
||||
->where('start_date', '<=', now()->toDateString())
|
||||
->exists();
|
||||
|
||||
$inCorso = $superata ? null : $this->campagna->assegnazioniInCorso()
|
||||
->with(['territorio', 'proclamatore'])
|
||||
->orderBy('assigned_at')
|
||||
->get();
|
||||
|
||||
// All assignments that were active during this campaign range
|
||||
$assegnateNelRange = Assegnazione::where('assigned_at', '<=', $this->campagna->end_date)
|
||||
->where(function ($q) {
|
||||
@@ -38,6 +50,7 @@ class CampagnaShow extends Component
|
||||
|
||||
return view('livewire.campagne.campagna-show', [
|
||||
'conteggiate' => $conteggiate,
|
||||
'inCorso' => $inCorso,
|
||||
'assegnateNelRange' => $assegnateNelRange,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user