-
Notifications
You must be signed in to change notification settings - Fork 10
Labels
Description
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
- Add any user as a viewer,collaborator or owner in myetm on a saved scenario
- Go to the saved scenario - you will see the user has appeared in myetm.
- Go to the scenario in the engine, look at the scenario users - nothing will have changed
- Check the engine db - a user is created with no id, but an email address (the pending user case)
mabijkerk