Skip to content

[BUG - Dev] Scenario Users not being added correctly #1653

@louispt1

Description

@louispt1

Bug Description

Adding ScenarioUsers in MyETM does not link the users correctly to their engine scenarios, despite myetm reflecting the scenario users as collaborators/viewers/owners.

The bug comes from users' emails and ids not being linked in the created ScenarioUser objects.


Where is it happening

Engine Pro. You can see in the inspect controller that scenario users are not added to the scenarios, and via the api.


Type of Issue

What type of dev issue is this?
Select all that apply:

  • User Experience
  • Unintuitive design
  • Calculation
  • API
  • Tests
  • Other

Expected Behaviour

ScenarioUsers should be linked with all available information (id & email or the max subset).


Current Behaviour

Currently the ScenarioUser model couples users by their id, even though the params from myetm actually pass the user email

def couple_existing_user
    return unless user_email.present? && user_id.blank?
    couple_to(User.find_by(id: user_id))  # Looks up by user_id 
  end

Steps to Reproduce

Modify the steps to fit your case

  1. Add any user as a viewer,collaborator or owner in myetm on a saved scenario
  2. Go to the saved scenario - you will see the user has appeared in myetm.
  3. Go to the scenario in the engine, look at the scenario users - nothing will have changed
  4. Check the engine db - a user is created with no id, but an email address (the pending user case)

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions