File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
services/static-webserver/client/source/class/osparc/service Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,14 @@ qx.Class.define("osparc.service.Utils", {
9898 }
9999 servicesArray . sort ( ( a , b ) => {
100100 if ( basedOn . sort === "hits" ) {
101- if ( a [ basedOn . sort ] !== b [ basedOn . sort ] ) {
101+ const aHits = a [ "hits" ] === undefined ? - 1 : a [ "hits" ] ; // Treat undefined hits as -1
102+ const bHits = b [ "hits" ] === undefined ? - 1 : b [ "hits" ] ; // Treat undefined hits as -1
103+
104+ if ( aHits !== bHits ) {
102105 if ( basedOn . order === "down" ) {
103- return b [ basedOn . sort ] - a [ basedOn . sort ] ;
106+ return bHits - aHits ;
104107 }
105- return a [ basedOn . sort ] - b [ basedOn . sort ] ;
108+ return aHits - bHits ;
106109 }
107110 return a [ "name" ] . localeCompare ( b [ "name" ] ) ;
108111 } else if ( basedOn . sort === "name" ) {
You can’t perform that action at this time.
0 commit comments