Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataValues are not set if the user does not make any changes before sending in #780

Closed
violaguttorm opened this issue Sep 19, 2024 · 7 comments
Assignees
Labels
good-first-issue Issues that are easy to fix for new team members or external contributors kind/bug Something isn't working

Comments

@violaguttorm
Copy link

Description of the bug

The dataValues fields are not set in an Instance if the user never makes any changes, but just clicks through the form and sends it in. We prefill some data, which means that occasionally a form might be filled correctly from the start and the user could just send it in, but we rely on these dataValues to correctly route the data to us.

Steps To Reproduce

  1. Use IInstantiationProcessor to prefill data that can be a correct form in a new Instance.
  2. Send this in.
  3. Observe that the dataValues fields have not been set.

Additional Information

No response

@violaguttorm violaguttorm added the kind/bug Something isn't working label Sep 19, 2024
@ivarne ivarne added the good-first-issue Issues that are easy to fix for new team members or external contributors label Sep 19, 2024
@martinothamar
Copy link
Contributor

Was not able to reproduce this. I have an app implementing an IInstantiationProcessor and created some dataFields in applicationmetadata.json (I think this is what was discussed in the Slack thread). As I instantiate the dataValues are filled in. They are also there after sending in the form.

Does it depend on how it is instantiated? I was doing this through the normal frontend

@martinothamar martinothamar self-assigned this Sep 24, 2024
@violaguttorm
Copy link
Author

Wait. Sorry, I actually forgot something important before reporting in. We actually prefill data in DataProcessing (IDataProcessor -> DataProcessRead) now (with a check to see if it has succeeded earlier to not double up). We do this since it's called anyway and we want the app to try again if the instance is opened again if the prefill failed earlier.

That might be the cause? If so, is there a way I can manually fill these values in? (Or maybe just make the call within IInstantiationProcessor too if that works when you test? 😅)

If relevant I can at least say that the data we filll into dataFields in applicationmetadata.json is data that the prefill fetched, so it didn't exist before instantiation ran.

@martinothamar
Copy link
Contributor

Yeah IDataProcessor is never called if the instance is only instantiated I think, so if you only rely on IDataProcessor then that explains the issue

@martinothamar
Copy link
Contributor

Is brg/rrh-innrapportering the right app? If the issue is reproducible there (while also prefilling from IInstantiationProcessor) then I can probably debug it

@violaguttorm
Copy link
Author

I tried putting Instantiation in IInstantiationProcessor and that fixed it. Case can be closed. Thank you for your time.

@ivarne ivarne reopened this Sep 25, 2024
@ivarne
Copy link
Member

ivarne commented Sep 25, 2024

I think the issue is that we don't update data values if you use a multipart request to initialise the instance and data elements.

await _instantiationProcessor.DataCreation(instance, data, null);

@martinothamar
Copy link
Contributor

dataFields and dataValues works in this case also, presumably because the IProcessTaskInitializer is running UpdateDataValuesOnInstance. That probably means we are running the processor hook twice though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Issues that are easy to fix for new team members or external contributors kind/bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

4 participants