Fix sorting not working as expected
This commit is contained in:
parent
23277a9159
commit
eadaf8d420
|
@ -104,37 +104,37 @@ func (queue MailQ) Sort(config qEntrySortConfig) {
|
|||
skip = false
|
||||
switch sortBy.attribute {
|
||||
case "Id":
|
||||
if queue.Entries[a].Id != queue.Entries[b].Id {
|
||||
if queue.Entries[a].Id == queue.Entries[b].Id {
|
||||
skip = true
|
||||
}
|
||||
cmp = queue.Entries[a].Id < queue.Entries[b].Id
|
||||
case "Status":
|
||||
if queue.Entries[a].Status != queue.Entries[b].Status {
|
||||
if queue.Entries[a].Status == queue.Entries[b].Status {
|
||||
skip = true
|
||||
}
|
||||
cmp = queue.Entries[a].Status < queue.Entries[b].Status
|
||||
case "Date":
|
||||
if !queue.Entries[a].Date.Equal(queue.Entries[b].Date) {
|
||||
if queue.Entries[a].Date.Equal(queue.Entries[b].Date) {
|
||||
skip = true
|
||||
}
|
||||
cmp = queue.Entries[a].Date.Before(queue.Entries[b].Date)
|
||||
case "Size":
|
||||
if queue.Entries[a].Size != queue.Entries[b].Size {
|
||||
if queue.Entries[a].Size == queue.Entries[b].Size {
|
||||
skip = true
|
||||
}
|
||||
cmp = queue.Entries[a].Size < queue.Entries[b].Size
|
||||
case "Sender":
|
||||
if queue.Entries[a].Sender != queue.Entries[b].Sender {
|
||||
if queue.Entries[a].Sender == queue.Entries[b].Sender {
|
||||
skip = true
|
||||
}
|
||||
cmp = queue.Entries[a].Sender < queue.Entries[b].Sender
|
||||
case "Recipients":
|
||||
if len(queue.Entries[a].Recipients) != len(queue.Entries[b].Recipients) {
|
||||
if len(queue.Entries[a].Recipients) == len(queue.Entries[b].Recipients) {
|
||||
skip = true
|
||||
}
|
||||
cmp = len(queue.Entries[a].Recipients) < len(queue.Entries[b].Recipients)
|
||||
case "Reason":
|
||||
if queue.Entries[a].Reason != queue.Entries[b].Reason {
|
||||
if queue.Entries[a].Reason == queue.Entries[b].Reason {
|
||||
skip = true
|
||||
}
|
||||
cmp = queue.Entries[a].Reason < queue.Entries[b].Reason
|
||||
|
|
Loading…
Reference in New Issue