8000 When sorting by an Association field use the instance name rather than the id · Issue #108 · cuba-platform/restapi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
When sorting by an Association field use the instance name rather than the id #108
Closed
@vyacheslav-pushkin

Description

@vyacheslav-pushkin

Environment

  • Platform version: 7.2.1
  • Addon version: 7.2.0

Description of the bug or enhancement

It seems that currently sorting by an Association field will use the id rather than the instance name. This results in unexpected behavior on Frontend UI side (see cuba-platform/frontend#202).

Here is the response to an attempt to sort the entity instances by associationO2Oattr field:

[{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 1","id":"032fd8a5-e042-4828-a802-36cbd2ce12de","doubleAttr":32.521,"offsetDateTimeAttr":"2020-01-01 11:11:11.000 +0400","integerIdTestEntityAssociationM2MAttr":[],"associationM2Mattr":[{"_entityName":"scr_AssociationM2MTestEntity","_instanceName":"ASSOCIATION-M2M-1","id":"fe66289d-bf1d-4777-90f7-788a1a4ed0fa","name":"ASSOCIATION-M2M-1"},{"_entityName":"scr_AssociationM2MTestEntity","_instanceName":"ASSOCIATION-M2M-2","id":"a13fe377-43a9-45e7-9b08-cefd4fac3761","name":"ASSOCIATION-M2M-2"}],"localDateTimeAttr":"2020-01-01 11:11:11.000","bigDecimalAttr":9131354156.12,"offsetTimeAttr":"11:11:11 +0400","compositionO2Oattr":{"_entityName":"scr_CompositionO2OTestEntity","_instanceName":"COMPOSITION-O2O-1","id":"76b5eb8c-522c-40ab-bd00-c761353684b3","name":"COMPOSITION-O2O-1"},"localDateAttr":"2020-01-01","stringAttr":"Lorem Ipsum","localTimeAttr":"11:11:11","enumAttr":"NEW_VALUE","associationO2Oattr":{"_entityName":"scr_AssociationO2OTestEntity","_instanceName":"ASSOCIATION-O2O-1","id":"1a8f4cd6-bc3a-46ef-8816-dda6ad484137","name":"ASSOCIATION-O2O-1"},"integerAttr":10482,"longAttr":9223372036854775807,"booleanAttr":true,"associationM2Oattr":{"_entityName":"scr_AssociationM2OTestEntity","_instanceName":"ASSOCIATION-M2O-1","id":"f6a3afc1-2c68-437c-9654-baf0035e34d0","name":"ASSOCIATION-M2O-1"},"uuidAttr":"c6a1cee6-f562-48a0-acbe-9625e0b278b1","dateAttr":"2020-01-01","associationO2Mattr":[{"_entityName":"scr_AssociationO2MTestEntity","_instanceName":"ASSOCIATION-O2M-1","id":"52a7b1e4-4727-4802-9eb2-b58bce0eaf6e","name":"ASSOCIATION-O2M-1"}],"byteArrayAttr":"MHgxMjM0NTY3","compositionO2Mattr":[{"_entityName":"scr_CompositionO2MTestEntity","_instanceName":"COMPOSITION-O2M-1","id":"6bea7f06-8247-4d80-85e9-0f4ddc6abf0a","name":"COMPOSITION-O2M-1","datatypesTestEntity":{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 1","id":"032fd8a5-e042-4828-a802-36cbd2ce12de"}},{"_entityName":"scr_CompositionO2MTestEntity","_instanceName":"COMPOSITION-O2M-3","id":"719e54f2-0487-4286-bada-4ab59da2eafd","name":"COMPOSITION-O2M-3","datatypesTestEntity":{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 1","id":"032fd8a5-e042-4828-a802-36cbd2ce12de"}}],"name":"Datatypes Test 1","timeAttr":"11:11:11","dateTimeAttr":"2020-01-01 11:11:11.000"},{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 3","id":"db9faa31-dfa3-4b97-943c-ba268888cdc3","doubleAttr":0.0,"offsetDateTimeAttr":"2020-03-03 03:03:03.000 +0400","integerIdTestEntityAssociationM2MAttr":[],"associationM2Mattr":[],"localDateTimeAttr":"2020-03-03 03:03:03.000","bigDecimalAttr":0.00,"offsetTimeAttr":"03:03:03 +0400","localDateAttr":"2020-03-03","localTimeAttr":"03:03:03","associationO2Oattr":{"_entityName":"scr_AssociationO2OTestEntity","_instanceName":"AAAAAA","id":"2906cee9-f25d-e412-e660-38c5357fc371","name":"AAAAAA"},"integerAttr":0,"longAttr":0,"uuidAttr":"db9faa31-dfa3-4b97-943c-ba268888cdc3","dateAttr":"2020-03-03","associationO2Mattr":[],"byteArrayAttr":"MHgwMDAwMDAw","compositionO2Mattr":[],"name":"Datatypes Test 3","timeAttr":"03:03:03","dateTimeAttr":"2020-03-03 03:03:03.000"},{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 2","id":"b1a1f3c9-6076-4725-8c4a-65a4267d15e1","doubleAttr":8234.3462,"offsetDateTimeAttr":"2020-02-02 22:22:22.000 +0400","integerIdTestEntityAssociationM2MAttr":[],"associationM2Mattr":[{"_entityName":"scr_AssociationM2MTestEntity","_instanceName":"ASSOCIATION-M2M-1","id":"fe66289d-bf1d-4777-90f7-788a1a4ed0fa","name":"ASSOCIATION-M2M-1"},{"_entityName":"scr_AssociationM2MTestEntity","_instanceName":"ASSOCIATION-M2M-2","id":"a13fe377-43a9-45e7-9b08-cefd4fac3761","name":"ASSOCIATION-M2M-2"},{"_entityName":"scr_AssociationM2MTestEntity","_instanceName":"ASSOCIATION-M2M-3","id":"8109ac31-9982-4156-ba30-a34591a4142b","name":"ASSOCIATION-M2M-3"}],"localDateTimeAttr":"2020-02-02 22:22:22.000","bigDecimalAttr":-8273729824.34,"offsetTimeAttr":"22:22:22 +0400","compositionO2Oattr":{"_entityName":"scr_CompositionO2OTestEntity","_instanceName":"COMPOSITION-O2O-2","id":"b7cae0ab-7192-49de-9dcc-17e5db5c65c1","name":"COMPOSITION-O2O-2"},"localDateAttr":"2020-02-02","stringAttr":"dolor sit amet","localTimeAttr":"22:22:22","enumAttr":"NEW_VALUE1","associationO2Oattr":{"_entityName":"scr_AssociationO2OTestEntity","_instanceName":"ASSOCIATION-O2O-2","id":"41b2d8cd-4976-487c-9df7-4c8ec900bdf6","name":"ASSOCIATION-O2O-2"},"integerAttr":304221,"longAttr":984299284249651,"booleanAttr":false,"associationM2Oattr":{"_entityName":"scr_AssociationM2OTestEntity","_instanceName":"ASSOCIATION-M2O-2","id":"dc9f6583-1262-40b2-857e-f9b0d85783bd","name":"ASSOCIATION-M2O-2"},"uuidAttr":"9b4188bf-c382-4b89-aedf-b6bcee6f2f76","dateAttr":"2020-02-02","associationO2Mattr":[{"_entityName":"scr_AssociationO2MTestEntity","_instanceName":"ASSOCIATION-O2M-2","id":"6eac3bce-f4b9-4c19-816c-3a06e0222cdb","name":"ASSOCIATION-O2M-2"}],"byteArrayAttr":"MHhBQkNERUYw","compositionO2Mattr":[{"_entityName":"scr_CompositionO2MTestEntity","_instanceName":"COMPOSITION-O2M-2","id":"12221d3b-ef8f-4857-9865-8a02bfa500c1","name":"COMPOSITION-O2M-2","datatypesTestEntity":{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 2","id":"b1a1f3c9-6076-4725-8c4a-65a4267d15e1"}},{"_entityName":"scr_CompositionO2MTestEntity","_instanceName":"COMPOSITION-O2M-4","id":"3db9e36a-d17c-47c0-9fca-5779666f6cee","name":"COMPOSITION-O2M-4","datatypesTestEntity":{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 2","id":"b1a1f3c9-6076-4725-8c4a-65a4267d15e1"}}],"name":"Datatypes Test 2","timeAttr":"22:22:22","dateTimeAttr":"2020-02-02 22:22:22.000"},{"_entityName":"scr_DatatypesTestEntity","_instanceName":"Datatypes Test 0","id":"00000000-0000-0000-0000-000000000000","integerIdTestEntityAssociationM2MAttr":[],"associationM2Mattr":[],"associationO2Oattr":{"_entityName":"scr_AssociationO2OTestEntity","_instanceName":"AAA","id":"5120455f-7e18-684b-d8c9-f4aafc0aa860","name":"AAA"},"associationO2Mattr":[],"compositionO2Mattr":[],"name":"Datatypes Test 0"},{"_entityName":"scr_DatatypesTestEntity","_instanceName":"","id":"4b8e7115-8b0d-f7d6-5469-38f57bde2b3b","integerIdTestEntityAssociationM2MAttr":[],"associationM2Mattr":[],"stringIdTestEntityAssociationO2O":{"_entityName":"scr_StringIdTestEntity","_instanceName":"[ID_001] Desc1","id":"ID_001","identifier":"ID_001","description":"Desc1"},"associationO2Mattr":[],"compositionO2Mattr":[]}]

Instad of being ordered by associationO2Oattr._instanceName (e.g. AAA, AAAAAA, ASSOCIATION-O2O-1, etc.), the instances seem to be sorted by the associationO2Oattr.id field:

instanceName: ASSOCIATION-O2O-1, id: 1a8f4cd6-bc3a-46ef-8816-dda6ad484137
instanceName: AAAAAA, id: 2906cee9-f25d-e412-e660-38c5357fc371
instanceName: ASSOCIATION-O2O-2, id: 41b2d8cd-4976-487c-9df7-4c8ec900bdf6
instanceName: AAA, id: 5120455f-7e18-684b-d8c9-f4aafc0aa860
instanceName: undefined, id: undefined

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0