Skip to content

Commit

Permalink
Save file path to correct field (#274)
Browse files Browse the repository at this point in the history
* Save file path to correct field

* Add test
  • Loading branch information
mmwinther authored Apr 8, 2024
1 parent 833fc8d commit 55ff9c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/datadoc/backend/datadoc_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def extract_metadata_from_dataset(
version=dapla_dataset_path_info.dataset_version,
contains_data_from=str(dapla_dataset_path_info.contains_data_from),
contains_data_until=str(dapla_dataset_path_info.contains_data_until),
data_source_path=self.dataset_path,
file_path=str(self.dataset_path),
metadata_created_by=user_info.get_user_info_for_current_platform().short_email,
# TODO @mmwinther: Remove multiple_language_support once the model is updated.
# https://github.com/statisticsnorway/ssb-datadoc-model/issues/41
Expand Down
1 change: 1 addition & 0 deletions src/datadoc/frontend/fields/display_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ class DatasetIdentifiers(str, Enum):
description="Filstien inneholder datasettets navn og stien til hvor det er lagret.",
obligatory=True,
editable=False,
value_getter=get_metadata_and_stringify,
),
DatasetIdentifiers.METADATA_CREATED_DATE: MetadataInputField(
identifier=DatasetIdentifiers.METADATA_CREATED_DATE.value,
Expand Down
4 changes: 4 additions & 0 deletions tests/backend/test_datadoc_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ def test_dataset_short_name(metadata: DataDocMetadata):
assert metadata.dataset.short_name == "person_data"


def test_dataset_file_path(metadata: DataDocMetadata):
assert metadata.dataset.file_path == str(metadata.dataset_path)


def test_variable_role_default_value(metadata: DataDocMetadata):
assert all(
v.variable_role == VariableRole.MEASURE.value for v in metadata.variables
Expand Down

0 comments on commit 55ff9c4

Please sign in to comment.