This repository was archived by the owner on Nov 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,16 @@ def show
2121 end
2222
2323 # FIXME: Change this When use ACTIVE_MODEL_CLASS as UserNeo4j
24- @friends = User . where ( :neo4j_uuid . in => friends . pluck ( :uuid ) )
24+ uuids = friends . map { |node | node . props [ :uuid ] || node . uuid }
25+ @friends = User . where ( :neo4j_uuid . in => friends . pluck ( :uuid ) ) .
26+ to_a . sort_by { |value | uuids . index ( value . neo4j_uuid ) } # preserving order
27+
2528 @friends_path = friends_path &.transform_values do |item |
2629 uuids = item . map { |node | node . props [ :uuid ] || node . uuid }
2730
2831 # it is necessary to order after query in database to preser correct path
2932 User . where ( :neo4j_uuid . in => uuids ) .
30- to_a . sort_by { |value | uuids . index ( value . neo4j_uuid ) }
33+ to_a . sort_by { |value | uuids . index ( value . neo4j_uuid ) } # preserving order
3134 end
3235 end
3336
Original file line number Diff line number Diff line change @@ -72,7 +72,6 @@ def friends_by_search(term)
7272
7373 total += ( friends_path [ item . uuid ] . length - 2 ) * 10
7474 total += item . titles . any? { titles . include? ( term ) } ? -10 : 0
75- total += item . subtitles . any? { |subtitle | subtitle . include? ( term ) } ? -5 : 0
7675
7776 total
7877 end
You can’t perform that action at this time.
0 commit comments