Skip to content

Comments

utils/attr_is_relation: add portfolio_type to relation set#176

Open
HenkKalkwater wants to merge 1 commit intomainfrom
add-portfolio-type-attr-to-relation-set
Open

utils/attr_is_relation: add portfolio_type to relation set#176
HenkKalkwater wants to merge 1 commit intomainfrom
add-portfolio-type-attr-to-relation-set

Conversation

@HenkKalkwater
Copy link
Contributor

/api/v1/portfolios/portfolio/ev-group/ returned group_name and group_identifier as numbers instead of strings. Other endpoints, like /api/v1/instruments/instrument/ev-group/ return strings correctly. These numerical values were then shown in the UI, as showcased in #149 (comment).

By marking portfolio_type as a relation, it now correctly shows the names when invoking this API endpoint.

/api/v1/portfolios/portfolio/ev-group/ returned `group_name` and
`group_identifier` as numbers instead of strings. Other endpoints, like
/api/v1/instruments/instrument/ev-group/ return strings correctly.
These numerical values were then shown in the UI, as showcased in
#149 (comment).

By marking `portfolio_type` as a relation, it now correctly shows the names when
invoking this API endpoint.
@HenkKalkwater
Copy link
Contributor Author

HenkKalkwater commented Feb 13, 2026

The frontend seems to rely on the back-end returning numbers, see:

https://github.com/finmars-platform/finmars-portal/blob/4580ddcbde8d1cbe7d3e7195ca8dd94b2a7489d3/src/portal/scripts/app/directives/groupTable/gEvLeftPanelTreeElemDirective.js#L233-L241

I'm not sure whether this is the correct way forward Edit: I think it is, combined with finmars-platform/finmars-portal#48 to use the backend names, so portfolio names are not hardcoded on their ID.

HenkKalkwater added a commit to finmars-platform/finmars-portal that referenced this pull request Feb 13, 2026
For portfolio types, the name is made up by looking at whatever the server
returns for this group, assume the database is pristine and no one messed around
with the portfolio types and changed ids.

Previously, the server returned a number as the group name. That is not very
helpful, so this is likely the reason this code existed in the first place.
After finmars-platform/finmars-core#176 is merged, the
server should return proper names, and this workaround should no longer be
necessary.
@falendary
Copy link
Member

@paktusov @HenkKalkwater please check whats wrong with the tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants