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

feat: add analytics module to handle /analytics endpoints #403

Merged
merged 27 commits into from
Oct 6, 2020

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Oct 1, 2020

🗒 This PR is complete with the exception of integration tests for AnalyticsRouter, see note below in the test section.

Problem

This PR extracts out analytics related functions in various controllers and services and reorganises them into the modules/analytics directory.

Related to #144

Solution

Features:

  • Add static findFormsWithSubsAbove method to SubmissionModel so it can be easily used by services
  • Add static aggregateFormCount method to FormStatisticsTotalModel so it can be easily used by services
  • Add AnalyticsService to retrieve user/submission/form counts from their various models.
  • Add AnalyticsFactory to return correct function handler for retrieving form counts depending on whether aggregate-stats feature is enabled in the Feature Manager
  • Add AnalyticsController controller handler for /analytics route
  • Replace current /analytics route with the new AnalyticsRouter

Tests

  • Add unit tests for analytics.service
  • Add unit tests for analytics.factory
  • Add unit tests for analytics.controller

This will be delayed until #371 is merged in as that contains code for generated an authenticated session (or should I cherry pick the appropriate commits? Scared that will scare ppl off with the commit size again)

  • Add integration tests for analytics.routes

@karrui karrui marked this pull request as draft October 1, 2020 08:55
@karrui karrui changed the title wip: add analytics module to handle /analytics endpoints feat: add analytics module to handle /analytics endpoints Oct 2, 2020
@karrui karrui marked this pull request as ready for review October 2, 2020 02:41
Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

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

lgtm with minor suggestions!

@karrui karrui merged commit f7dfa49 into develop Oct 6, 2020
@karrui karrui deleted the ref/ts-analytics-routes branch October 6, 2020 06:31
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.

None yet

2 participants