MH: Dienstplaner Bugfix
This commit is contained in:
@@ -572,7 +572,23 @@ namespace BeWo.Service.Dienstplanung
|
||||
for (int i = 0; i < zeile.DienstDictArray.Length; i++)
|
||||
{
|
||||
var empDienste = dienstvertretungenDC
|
||||
.Where(x => x.EmployeeOid == emp.EmployeeOid && x.Zeile == i);
|
||||
.Where(x => x.EmployeeOid == emp.EmployeeOid && x.Zeile == i).ToList();
|
||||
|
||||
// Doppelte rausnehmen, die sollte es technisch eigentlich gar nicht geben
|
||||
var doppelteEintraege = empDienste
|
||||
.GroupBy(e => new { e.EmployeeOid, e.Zeile, e.Datum })
|
||||
.Where(g => g.Count() > 1) // Nur welche, die es mehr als einmal gibt
|
||||
.SelectMany(g => g.Skip(1)) // Lässt das erste Element jeder Gruppe weg, damit beim Löschen der Doppelten einer übrig bleibt
|
||||
.ToList();
|
||||
if (doppelteEintraege != null && doppelteEintraege.Count > 0)
|
||||
{
|
||||
for (int x = empDienste.Count - 1; x > 0; x--)
|
||||
{
|
||||
var dienst = empDienste[x];
|
||||
if (doppelteEintraege.Any(d => d.Oid == dienst.Oid))
|
||||
empDienste.RemoveAt(x);
|
||||
}
|
||||
}
|
||||
|
||||
zeile.DienstDictArray[i] = empDienste
|
||||
.ToDictionary(x => x.Datum.Day, x => x.DienstOid);
|
||||
|
||||
Reference in New Issue
Block a user