Embed assets and fix offline/sync/pricing issues

This commit is contained in:
2026-02-03 21:58:02 +03:00
parent 8d84484412
commit 20056f3593
9 changed files with 170 additions and 67 deletions

View File

@@ -134,12 +134,16 @@ func (s *Service) SyncPricelists() (int, error) {
synced := 0
var latestLocalID uint
var latestServerID uint
for _, pl := range serverPricelists {
// Check if pricelist already exists locally
existing, _ := s.localDB.GetLocalPricelistByServerID(pl.ID)
if existing != nil {
// Already synced, track latest
latestLocalID = existing.ID
// Already synced, track latest by server ID
if pl.ID > latestServerID {
latestServerID = pl.ID
latestLocalID = existing.ID
}
continue
}
@@ -167,7 +171,10 @@ func (s *Service) SyncPricelists() (int, error) {
slog.Debug("synced pricelist with items", "version", pl.Version, "items", itemCount)
}
latestLocalID = localPL.ID
if pl.ID > latestServerID {
latestServerID = pl.ID
latestLocalID = localPL.ID
}
synced++
}