Riporta a bozza le schede non inviate senza reparto o motivo

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
MarcoEandClaude Opus 5.5 committed 2026-09-29 10:33:01 +02:00
1 parent de889ef8c7
commit e524c12a96
1 file changed
+17 -2
@@ -155,14 +155,29 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
await db.SaveChangesAsync(); await db.SaveChangesAsync();
} }
public Task<List<Scheda>> GetAllSchedeOfIspezioneAsync(string codMdep, DateTime data, string rilevatore) => public async Task<List<Scheda>> GetAllSchedeOfIspezioneAsync(string codMdep, DateTime data, string rilevatore)
db.Schede {
// Le versioni precedenti dell'app hanno lasciato schede non bozza senza
// reparto o motivo: risultano inviabili ma il server le rifiuta, e
// bloccano la conclusione dell'ispezione. Tornano bozze, cosi' il
// rilevatore le completa. Quelle gia' inviate non si toccano.
await db.Schede
.Where(x => x.CodMdep == codMdep &&
x.Data == data &&
x.Rilevatore == rilevatore &&
!x.Bozza &&
x.ActivityId == null &&
(string.IsNullOrEmpty(x.CodJfas) || string.IsNullOrEmpty(x.ActivityTypeId)))
.ExecuteUpdateAsync(s => s.SetProperty(x => x.Bozza, true));
return await db.Schede
.AsNoTracking() .AsNoTracking()
.Include(s => s.Articoli) .Include(s => s.Articoli)
.Where(x => x.CodMdep == codMdep && .Where(x => x.CodMdep == codMdep &&
x.Data == data && x.Data == data &&
x.Rilevatore == rilevatore) x.Rilevatore == rilevatore)
.ToListAsync(); .ToListAsync();
}
public Task<Scheda?> GetSchedaAsync(int schedaId) => public Task<Scheda?> GetSchedaAsync(int schedaId) =>
db.Schede db.Schede