diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9460599..f77aad2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -12,6 +12,12 @@ This project has been funded by DG ECHO and implemented by Caritas Switzerland a All release notes for this project will be documented in this file; this project follows [Semantic Versioning](https://semver.org/). +## v0.0.7 - 2022-01-20 + +### Bug fixes and improvements :bug: + +- Add additional export configurations. PR [#27](https://github.com/onaio/duva/pull/27) + ## v0.0.6 - 2021-10-25 ### Bug fixes and improvements :bug: diff --git a/app/schemas.py b/app/schemas.py index 1cf0a2b..9f7462b 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -72,6 +72,8 @@ class ExportConfigurationSettings(BaseModel): include_reviews: Optional[bool] = False include_labels_only: Optional[bool] = True value_select_multiples: Optional[bool] = True + show_choice_labels: Optional[bool] = True + binary_select_multiples: Optional[bool] = True class ConfigurationResponse(BaseModel): diff --git a/app/settings.py b/app/settings.py index 8b45c7c..bdce1de 100644 --- a/app/settings.py +++ b/app/settings.py @@ -4,7 +4,7 @@ class Settings(BaseSettings): app_name: str = "Duva" app_description: str = "" - app_version: str = "v0.0.6" + app_version: str = "v0.0.7" app_host: str = "127.0.0.1" app_port: int = 8000 database_url: str = "postgres://duva:duva@127.0.0.1/duva" diff --git a/app/tests/utils/test_onadata_utils.py b/app/tests/utils/test_onadata_utils.py index 588ecee..92afbbb 100644 --- a/app/tests/utils/test_onadata_utils.py +++ b/app/tests/utils/test_onadata_utils.py @@ -103,11 +103,10 @@ def test_get_csv_export( ) assert ret == Path(file_mock.name) mock_get_access_token.assert_called_with(user, server, self.db) - expected_query_params = "&".join( - [ - f"{param}={value}" - for param, value in configuration.export_settings.items() - ] + expected_query_params = ( + "include_labels=True&remove_group_name=True&do_not_split_select_multiple=False" + "&include_reviews=False&include_labels_only=True&value_select_multiples=True&" + "show_choice_labels=True&binary_select_multiples=True" ) mock_get_csv_export.assert_called_with( f"{server.url}/api/v1/forms/{hyperfile.form_id}/export_async.json?format=csv&{expected_query_params}", diff --git a/app/utils/onadata_utils.py b/app/utils/onadata_utils.py index df972f6..0b907b6 100644 --- a/app/utils/onadata_utils.py +++ b/app/utils/onadata_utils.py @@ -159,7 +159,10 @@ def get_csv_export( if resp.status_code == 200: url = f"{form_url}/export_async.json?format=csv" if hyperfile.configuration: - export_settings = hyperfile.configuration.export_settings + export_settings = schemas.ExportConfigurationSettings( + **hyperfile.configuration.export_settings + ).dict() + for key, value in export_settings.items(): url += f"&{key}={value}"