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:
1 parent
de889ef8c7
commit
e524c12a96
1 file changed
+17
-2
@@ -155,14 +155,29 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public Task<List<Scheda>> GetAllSchedeOfIspezioneAsync(string codMdep, DateTime data, string rilevatore) =>
|
||||
db.Schede
|
||||
public async Task<List<Scheda>> GetAllSchedeOfIspezioneAsync(string codMdep, DateTime data, string rilevatore)
|
||||
{
|
||||
// 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()
|
||||
.Include(s => s.Articoli)
|
||||
.Where(x => x.CodMdep == codMdep &&
|
||||
x.Data == data &&
|
||||
x.Rilevatore == rilevatore)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public Task<Scheda?> GetSchedaAsync(int schedaId) =>
|
||||
db.Schede
|
||||
|
||||
Reference in new issue
Block a user