From 09dacf3be2f3b6676626c58a3770a7444915de65 Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Wed, 3 Jul 2019 15:35:49 +0200 Subject: [PATCH] Fix infinite update for image annotation (#1889) --- app/controllers/assets_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 9aecf53eb..19746574e 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -11,6 +11,7 @@ class AssetsController < ApplicationController include ApplicationHelper include InputSanitizeHelper include FileIconsHelper + include MyModulesHelper before_action :load_vars, except: :create_wopi_file before_action :check_read_permission, except: :file_present @@ -177,6 +178,9 @@ class AssetsController < ApplicationController @asset.step&.protocol&.update(updated_at: Time.now) render_html = if @asset.step + assets = @asset.step.assets + order_atoz = az_ordered_assets_index(assets, @asset.id) + order_ztoa = assets.length - az_ordered_assets_index(assets, @asset.id) asset_position = @asset.step.asset_position(@asset) render_to_string( partial: 'steps/attachments/item.html.erb', @@ -184,7 +188,9 @@ class AssetsController < ApplicationController asset: @asset, i: asset_position[:pos], assets_count: asset_position[:count], - step: @asset.step + step: @asset.step, + order_atoz: order_atoz, + order_ztoa: order_ztoa }, formats: :html )