Conversation
Fix a few bugs and cover a gap in re-linking portfolios and runs.
| for s in scenario: | ||
| s.portfolio_uuid = p_uuid | ||
| s.save() | ||
|
|
There was a problem hiding this comment.
@Bill-Becker Am I allowed to delete PortfolioUnlinkedRuns objects?
I realized that when we link a portfolio to an existing run, there can be a situation where the run is listed in PortfolioUnlinkedRuns, ie it was unlinked from a portfolio previously. In this case we do not want the run to show up in independent summary endpoint runs, which is why we'd have to delete that entry from PortfolioUnlinkedRuns table. I tested to see that an existing run can be deleted from PortfolioUnlinkedRuns so it doesnt show up in independent summary runs, and then unlinked from that portfolio so it does show up. This could be a niche use case so i can remove this.
| run_uuid__in=[i.run_uuid for i in UserUnlinkedRuns.objects.filter(user_uuid=user_uuid)] | ||
| ).only( | ||
| 'run_uuid', | ||
| 'user_uuid', |
There was a problem hiding this comment.
Added these two fields in Summary response for informational and validation purposes. The UI can ignore these.
| return JsonResponse({"Error": "Run {} is not associated with user {}".format(run_uuid, user_uuid)}, status=400) | ||
| else: | ||
| return JsonResponse({"Error": "Error in unlinking run {} from portfolio {}".format(run_uuid, portfolio_uuid)}, status=400) | ||
| pass |
There was a problem hiding this comment.
Fixed a bug here so unlinking actually happens.
Updated JSON response to delineate between adding a portfolio uuid vs deleting from existing portfolio runs.
Fix a few bugs and cover a gap in re-linking portfolios and runs.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
(Bug fix, feature, docs update, ...)
Bug fix
What is the current behavior?
(You can also link to an open issue here)
Runs cannot be unlinked; once a run is unlinked from a portfolio, it cannot be re-linked to that portfolio.
What is the new behavior (if this is a feature change)?
Runs can be unlinked and successfully relinked to portfolios
Does this PR introduce a breaking change?
(What changes might users need to make in their application due to this PR?)
No
Other information: