Compare commits

...

2 Commits

Author SHA1 Message Date
23db4de1ee Database: Fix xtime/mtime for delivery parts
All checks were successful
Test / Run tests (push) Successful in 3m17s
2026-02-19 15:31:36 +01:00
9e5f709d42 DeliveryConfirmation: Show 'Davon abgewertet' below total sum 2026-02-19 15:26:09 +01:00
5 changed files with 26 additions and 7 deletions

View File

@@ -100,6 +100,12 @@
<td></td>
<td></td>
</tr>
<tr>
<td colspan="8">Davon abgewertet:</td>
<td colspan="2" class="number">@($"{Model.Data.Rows.Where(p => p.IsDepreciated).Sum(p => p.Weight):N0}")</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
@Raw(BusinessDocument.PrintSortenaufteilung(Model.MemberStats))

View File

@@ -9,7 +9,7 @@ namespace Elwig.Helpers {
public static class AppDbUpdater {
// Don't forget to update value in Tests/fetch-resources.bat!
public static readonly int RequiredSchemaVersion = 36;
public static readonly int RequiredSchemaVersion = 37;
private static int VersionOffset = 0;

View File

@@ -75,6 +75,7 @@ namespace Elwig.Models.Dtos {
public string? Attribute;
public string? Cultivation;
public string QualityLevel;
public bool IsDepreciated;
public (double Oe, double Kmw) Gradation;
public string[] Modifiers;
public int Weight;
@@ -89,17 +90,15 @@ namespace Elwig.Models.Dtos {
Attribute = p.Attribute?.Name;
Cultivation = p.Cultivation?.Name;
QualityLevel = p.Quality.Name;
IsDepreciated = p.QualId == "WEI";
Gradation = (p.Oe, p.Kmw);
Modifiers = p.Modifiers
.Select(m => m.Name)
.ToArray();
Modifiers = [.. p.Modifiers.Select(m => m.Name)];
Weight = p.Weight;
IsNetWeight = p.IsNetWeight;
Buckets = p.Buckets
Buckets = [.. p.Buckets
.Where(b => b.Value > 0)
.OrderByDescending(b => b.BktNr)
.Select(b => (b.Discr == "_" ? "ungeb." : $"geb. {p.SortId}{b.Discr}", b.Value))
.ToArray();
.Select(b => (b.Discr == "_" ? "ungeb." : $"geb. {p.SortId}{b.Discr}", b.Value))];
}
}
}

View File

@@ -1,6 +1,8 @@
-- schema version 34 to 35
UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS';
ALTER TABLE delivery_part ADD COLUMN unloading TEXT DEFAULT NULL;
UPDATE delivery_part SET unloading = 'pumped' WHERE lesewagen;
UPDATE delivery_part SET unloading = 'box' WHERE (SELECT zwstid IN ('H','S') FROM delivery d WHERE (d.year, d.did) = (delivery_part.year, delivery_part.did));
ALTER TABLE delivery_part DROP COLUMN lesewagen;
UPDATE client_parameter SET value = '1' WHERE param = 'ENABLE_TIME_TRIGGERS';

View File

@@ -0,0 +1,12 @@
-- schema version 36 to 37
UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS';
-- fix old deliveries
UPDATE delivery SET xtime = NULL, mtime = ctime WHERE year <= 2022 AND mtime >= 1768521600 AND mtime < 1772323200;
UPDATE delivery_part SET xtime = NULL, mtime = ctime WHERE year <= 2022 AND mtime >= 1768521600 AND mtime < 1772323200;
-- clear xtime at one laptop to force updates from this one
UPDATE delivery SET xtime = NULL WHERE year >= 2023 AND xtime >= 1771200000 AND xtime < 1771286400;
UPDATE delivery_part SET xtime = NULL WHERE year >= 2023 AND xtime >= 1771200000 AND xtime < 1771286400;
UPDATE client_parameter SET value = '1' WHERE param = 'ENABLE_TIME_TRIGGERS';