mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: consider dive-number on sorting
A user reports a problem when dives have the same time but different numbers. The dives appear sorted randomly (effectively they are sorted by an internal unique-id). Try to sort by number for dives at the same date in this case. Fixes #2086 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e362afe43c
commit
114b3d9d47
2 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
- Import: Small enhancements on Suunto SDE import
|
- Import: Small enhancements on Suunto SDE import
|
||||||
- Desktop: Add import dive site menu option and site selection dialog
|
- Desktop: Add import dive site menu option and site selection dialog
|
||||||
|
- Core: Sort dives by number if at the same date
|
||||||
- Core: fix bug in get_distance() to correctly compute spherical distance
|
- Core: fix bug in get_distance() to correctly compute spherical distance
|
||||||
- Desktop: For videos, add save data export as subtitle file
|
- Desktop: For videos, add save data export as subtitle file
|
||||||
- Desktop: make dive sites 1st class citizens with their own dive site table
|
- Desktop: make dive sites 1st class citizens with their own dive site table
|
||||||
|
|
|
@ -779,7 +779,7 @@ struct dive *last_selected_dive()
|
||||||
* After editing a key used in this sort-function, the order of
|
* After editing a key used in this sort-function, the order of
|
||||||
* the dives must be re-astablished.
|
* the dives must be re-astablished.
|
||||||
* Currently, this does a lexicographic sort on the
|
* Currently, this does a lexicographic sort on the
|
||||||
* (start-time, trip-time, id) tuple.
|
* (start-time, trip-time, number, id) tuple.
|
||||||
* trip-time is defined such that dives that do not belong to
|
* trip-time is defined such that dives that do not belong to
|
||||||
* a trip are sorted *after* dives that do. Thus, in the default
|
* a trip are sorted *after* dives that do. Thus, in the default
|
||||||
* chronologically-descending sort order, they are shown *before*.
|
* chronologically-descending sort order, they are shown *before*.
|
||||||
|
@ -804,6 +804,10 @@ static int comp_dives(const struct dive *a, const struct dive *b)
|
||||||
if (trip_date(a->divetrip) > trip_date(b->divetrip))
|
if (trip_date(a->divetrip) > trip_date(b->divetrip))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (a->number < b->number)
|
||||||
|
return -1;
|
||||||
|
if (a->number > b->number)
|
||||||
|
return 1;
|
||||||
if (a->id < b->id)
|
if (a->id < b->id)
|
||||||
return -1;
|
return -1;
|
||||||
if (a->id > b->id)
|
if (a->id > b->id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue