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

Improve widget data retrieval #140

Merged
merged 7 commits into from
Oct 25, 2024
Merged

Conversation

alepefe-vizz
Copy link
Collaborator

This pull request introduces several important changes to improve the data handling and retrieval processes in the survey data repository and widgets service. The changes include refactoring the data source manager, enhancing the survey data repository, and updating the widgets service to support new functionalities.

Refactoring and Dependency Management:

  • Removed the SQLAdapter dependency from the DataSourceManager class and updated the constructor accordingly (api/src/infrastructure/data-source-manager.ts). [1] [2]

Enhancements to Survey Data Repository:

  • Introduced a new method addSurveyDataToBaseWidget to the PostgresSurveyDataRepository class for adding survey data to a base widget (api/src/infrastructure/postgres-survey-data.repository.ts).
  • Refactored the answersTable variable to be a class property and updated all relevant methods to use this.answersTable (api/src/infrastructure/postgres-survey-data.repository.ts). [1] [2] [3] [4]

Updates to Widgets Service:

  • Added a new method findWidgetWithDataById to the WidgetsService class to retrieve a widget with its associated data by its ID (api/src/modules/widgets/widgets.service.ts).
  • Injected the ISurveyDataRepository dependency into the WidgetsService class and updated the constructor accordingly (api/src/modules/widgets/widgets.service.ts).

Test Enhancements:

  • Added a new test case to verify the retrieval of a widget with data by its ID in the base-widgets.spec.ts file (api/test/e2e/widgets/base-widgets.spec.ts).
  • Updated the createBaseWidget function to ensure the creation of QuestionIndicatorMap if it does not exist (shared/lib/entity-mocks.ts). [1] [2]

Dependency Injection and Module Configuration:

  • Registered PostgresSurveyDataRepository and SQLAdapter in the WidgetsModule and updated the providers array accordingly (api/src/modules/widgets/widgets.module.ts).

These changes collectively enhance the functionality and maintainability of the survey data handling and widget retrieval processes.

Copy link

vercel bot commented Oct 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
4-growth ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2024 7:34am

…t so they are in line with the latest survey
Copy link
Collaborator

@alexeh alexeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alepefe-vizz

Since you decided not to apply some suggested changes as part of the implementation of the widget data retrieval, I won't push for that anymore

@alepefe-vizz alepefe-vizz merged commit 20a3cd9 into dev Oct 25, 2024
4 checks passed
@alepefe-vizz alepefe-vizz deleted the improve-widget-data-retrieval branch October 25, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants