Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Sort AlbumFileEntry to process non-deleted entries first

Neeraj Guptaa2f1edb14b54
diff --git a/pkg/model/remote.go b/pkg/model/remote.go
index 52f97104e0..ed73268823 100644
--- a/pkg/model/remote.go
+++ b/pkg/model/remote.go
@@ -3,6 +3,7 @@ package model
import (
"cli-go/pkg/model/export"
"fmt"
+ "sort"
"time"
)
@@ -53,6 +54,16 @@ type AlbumFileEntry struct {
SyncedLocally bool `json:"localSync"`
}
+// Sort list of AlbumFileEntry by IsDeleted and then by albumID
+func SortAlbumFileEntry(entries []*AlbumFileEntry) {
+ sort.Slice(entries, func(i, j int) bool {
+ if entries[i].IsDeleted != entries[j].IsDeleted {
+ return !entries[i].IsDeleted && entries[j].IsDeleted
+ }
+ return entries[i].AlbumID < entries[j].AlbumID
+ })
+}
+
func (r *RemoteFile) GetFileType() FileType {
value, ok := r.Metadata["fileType"]
if !ok {