Commit 5c8b9aec authored by Ujvari Gergely's avatar Ujvari Gergely

Sort incoming annotations

parent 663717f4
...@@ -141,6 +141,11 @@ class StreamSearch ...@@ -141,6 +141,11 @@ class StreamSearch
uuid.v4 null, buffer, 0 uuid.v4 null, buffer, 0
@clientID = uuid.unparse buffer @clientID = uuid.unparse buffer
$scope.sortAnnotations = (a, b) ->
a_upd = if a.updated? then new Date(a.updated) else new Date()
b_upd = if b.updated? then new Date(b.updated) else new Date()
a_upd.getTime() - b_upd.getTime()
# Read search params # Read search params
search_query = '' search_query = ''
params = $location.search() params = $location.search()
...@@ -222,6 +227,7 @@ class StreamSearch ...@@ -222,6 +227,7 @@ class StreamSearch
if data.length if data.length
$scope.$apply => $scope.$apply =>
$scope.empty = false $scope.empty = false
data = data.sort($scope.sortAnnotations)
$scope.manage_new_data data, action $scope.manage_new_data data, action
else else
unless $scope.annotations.length unless $scope.annotations.length
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment