Altinn / app-frontend-react

Altinn application React frontend
BSD 3-Clause "New" or "Revised" License
18 stars 31 forks source link

Backend should return dataElements in timestamp order #2226

Closed danielskovli closed 4 months ago

danielskovli commented 4 months ago

InstancesController.Get returns an instance object containing a data property. This property is an array of objects, in seemingly random order.

To be fair, the order is consistent between reloads, but otherwise completely useless.

We wish for the order of this list to be based on the timestamp when the associated dataElement was created, in ascending order.

danielskovli commented 4 months ago

This has been implemented as a proposal in branch feature/subform for both app-localtest and altinn-storage.

The functionality has been verified in app-localtest, but as always the testing in altinn-storage is a bit more elusive.

@SandGrainOne Do you see any immediate concerns with the approach taken by the two commits linked above? I can't imagine this resulting in a breaking change, since we're going from pseudo-random to ordered results, but I also don't have the whole perspective on situations like these.

As for unit testing in altinn-storage, I can't even get them to run so I haven't been able to do much validation there.

SandGrainOne commented 4 months ago

Running Storage and the integration tests require a pre configured PostgreSQL database. I can understand it's a bit of a hassle.

The change looks safe enough. Nothing I know of is sensitive to the order of data elements.

HauklandJ commented 3 months ago

Running Storage and the integration tests require a pre configured PostgreSQL database. I can understand it's a bit of a hassle.

@SandGrainOne What needs to be configured? Does anything need to be populated in the DB for the tests to run? Is there a setup guide somewhere?

SandGrainOne commented 3 months ago

@HauklandJ Start with the readme: https://github.com/Altinn/altinn-storage/#setting-up-postgresql

The setup guide we have is for Events, but the pattern is identical. All use of events should be replaced with storage. E.g eventsdb becomes storagedb and so on.