-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Summary
The current implementation updates the dataset size incrementally when a new OrigDatablock is created:
const createOrigDatablock: CreateOrigDatablockDto = {
...createDatasetOrigDatablockDto,
datasetId: pid,
ownerGroup: dataset.ownerGroup,
accessGroups: dataset.accessGroups,
instrumentGroup: dataset.instrumentGroup,
};
const datablock =
await this.origDatablocksService.create(createOrigDatablock);
const updateDatasetDto: PartialUpdateDatasetObsoleteDto = {
size: dataset.size + datablock.size,
numberOfFiles: dataset.numberOfFiles + datablock.dataFileList.length,
};
await this.datasetsService.findByIdAndUpdate(dataset.pid, updateDatasetDto);This assumes that dataset.size and dataset.numberOfFiles always represent the sum of existing OrigDatablocks.
However, users can create a dataset with a predefined size and numberOfFiles before any OrigDatablock is created. When the first OrigDatablock is later added, the dataset values are incremented on top of the existing values, resulting in incorrect totals.
Steps to Reproduce
Create dataset
/api/v3/datasets
{
...otherfileds,
size: 1000,
numberOfFiles: 2
}Create origDatablock
api/v3/datasets/:pid/origdatablocks
{
...otherfields,
"dataFileList": [
{
"path": "string/string",
"size": 1111,
"time": "2026-03-04T09:37:02.960Z",
"chk": "teststring",
}
],
}Current Behaviour
Fetch created dataset
api/v3/datasets/:pid
{
...otherfields,
size: 2111,
numberOfFiles:3
}Expected Behaviour
Fetch created dataset
api/v3/datasets/:pid
{
...otherfields,
size: 1111,
numberOfFiles:1
}Extra Details
Provide all the relevant details related to this issues. Include screenshot, wireframes and mockups if helpful.
PS: make ssure to add the proper tags to the issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels