File tree Expand file tree Collapse file tree 4 files changed +3
-30
lines changed
Expand file tree Collapse file tree 4 files changed +3
-30
lines changed Original file line number Diff line number Diff line change @@ -406,26 +406,6 @@ def export
406406 )
407407 end
408408
409- # PUT /api/v3/scenarios/:id/couple_users
410- def couple_users
411- @scenario = Scenario . find ( params [ :id ] )
412- authorize! ( :update , @scenario )
413-
414- users_data = params . require ( :users )
415-
416- users_data . each do |user_data |
417- scenario_user = @scenario . scenario_users . find_by ( user_email : user_data [ :user_email ] )
418- next unless scenario_user
419-
420- user = User . find_by ( id : user_data [ :user_id ] )
421- next unless user
422-
423- scenario_user . update ( user :, user_email : nil )
424- end
425-
426- head :ok
427- end
428-
429409 private
430410
431411 def find_preset_or_scenario
Original file line number Diff line number Diff line change @@ -400,10 +400,8 @@ def copy_roles_from_saved_scenario
400400 end
401401
402402 def fetch_saved_scenario_id_for ( scenario_id )
403- response = ETEngine ::MyEtm . client . get ( "/api/v1/saved_scenarios/by_scenario/#{ scenario_id } " )
404- response . success? ? response . body [ 'id' ] : nil
405- rescue Faraday ::Error
406- nil
403+ scenario = Scenario . find_by ( id : scenario_id )
404+ scenario &.metadata &.dig ( 'saved_scenario_id' )
407405 end
408406
409407 def fetch_saved_scenario_users ( saved_scenario_id )
Original file line number Diff line number Diff line change 2929 get :merit
3030 get :dump
3131 put :dashboard
32- put :couple_users
3332 post :interpolate
3433 post :uncouple
3534 post :couple
Original file line number Diff line number Diff line change @@ -7,16 +7,12 @@ module MyEtm
77
88 # Returns a Faraday client configured to communicate with MyETM.
99 def client
10- @client ||= Faraday . new ( url : myetm_url ) do |conn |
10+ @client ||= Faraday . new ( url : Settings . identity . issuer ) do |conn |
1111 conn . request ( :json )
1212 conn . response ( :json )
1313 conn . response ( :raise_error )
1414 conn . options . timeout = 5
1515 end
1616 end
17-
18- def myetm_url
19- Settings . identity . issuer &.gsub ( %r{/+$} , '' ) || 'http://localhost:3002'
20- end
2117 end
2218end
You can’t perform that action at this time.
0 commit comments