aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/workbenches_controller.rb
diff options
context:
space:
mode:
authorRobert2017-04-24 14:16:52 +0200
committerRobert2017-04-24 14:16:52 +0200
commit2d19e65fa8d8ac037c7f00a638111788b7ee002c (patch)
tree830fe41ac13743f75f2c16f41dfd1ff399b99a9b /app/controllers/workbenches_controller.rb
parent5003acfc533baa824fed11cf6f82f86393b3a0f6 (diff)
parent1cbed80c913420c76ac7d3716b9d8c4bf4e14278 (diff)
downloadchouette-core-2d19e65fa8d8ac037c7f00a638111788b7ee002c.tar.bz2
conflict resolution and asset recompilation
Diffstat (limited to 'app/controllers/workbenches_controller.rb')
-rw-r--r--app/controllers/workbenches_controller.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index 1424fe03c..d621a28d7 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -37,10 +37,11 @@ class WorkbenchesController < BreadcrumbController
end
def sort_result collection
- col = (Workbench.find(params[:id]).referentials.column_names + %w{lines}).include?(params[:sort]) ? params[:sort] : 'name'
+ col = (Workbench.find(params[:id]).referentials.column_names + %w{lines validity_period}).include?(params[:sort]) ? params[:sort] : 'name'
dir = %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
- if col == "lines"
- collection.joins(:metadatas).group("referentials.id").order("sum(array_length(referential_metadata.line_ids,1)) #{dir}")
+
+ if ['lines', 'validity_period'].include?(col)
+ collection.send("order_by_#{col}", dir)
else
collection.order("#{col} #{dir}")
end