Skip to content

Commit

Permalink
Use index (position on Atlas data) for temporal order
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans5958 committed Jun 20, 2023
1 parent a17b9df commit da4efb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion web/_js/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,9 @@ async function init() {
}

function updateAtlasAll(atlas = atlasAll) {
for (const entry of atlas) {
for (const index in atlas) {
const entry = atlas[index]
entry._index = index
const currentLinks = entry.links
entry.links = {
website: [],
Expand Down
4 changes: 2 additions & 2 deletions web/_js/main/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,10 @@ function buildObjectsList(filter, sort = defaultSort) {
sortFunction = (a, b) => b.name.toLowerCase().localeCompare(a.name.toLowerCase())
break
case "newest":
sortFunction = (a, b) => b.id.length - a.id.length || b.id.localeCompare(a.id)
sortFunction = (a, b) => b._index - a._index
break
case "oldest":
sortFunction = (a, b) => a.id.length - b.id.length || a.id.localeCompare(b.id)
sortFunction = (a, b) => a._index - b._index
break
case "area":
sortFunction = (a, b) => calcPolygonArea(b.path) - calcPolygonArea(a.path)
Expand Down

0 comments on commit da4efb6

Please sign in to comment.