Altinn / Altinn/app-lib-dotnet

Remove duplicat code for updating datavalues and presentationtexts based on formdata

Open
#453 0 comments 1 reaction 0 assignees View on GitHub
kind/chore status/draft
Dominant language
C#
Stars
8
Forks
27
Avg merge
1h 21m
Merged PRs (30d)
7

Description

### Description

Currently we have duplicate code for updating datavaules and presentationstexts in [`InstanceController`](https://github.com/Altinn/app-lib-dotnet/blob/main/src/Altinn.App.Api/Controllers/InstancesController.cs#L1022-L1055), [`DataController`](https://github.com/Altinn/app-lib-dotnet/blob/main/src/Altinn.App.Api/Controllers/DataController.cs#L661-L693) and [`DefaultTaskEvents`](https://github.com/Altinn/app-lib-dotnet/blob/main/src/Altinn.App.Core/Implementation/DefaultTaskEvents.cs#L328-L366) (soon to be removed, but code is still duplicated).
As this code is executed when a datatype connected to these fields are updated this is something that I think should be located in a `DataService` that ensures that they are updated every time the data is

### Additional Information

_No response_

### Tasks

_No response_

### Acceptance Criterias

* Duplicated code is remove
* Every update of data results in updated datavalues and presentationstexts

Contributor guide

Open the contributing guide

Research direction

Start by comparing the duplicated update logic in src/Altinn.App.Api/Controllers/InstancesController.cs, src/Altinn.App.Api/Controllers/DataController.cs, and src/Altinn.App.Core/Implementation/DefaultTaskEvents.cs at the referenced sections, then inspect the DataService entry points. Done means the duplicated code is removed and every relevant data update also updates datavalues and presentationtexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.