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

Rewrite answer.js into enketoHelper.ts #1063

Merged

Commits on Oct 11, 2023

  1. Merge remote-tracking branch 'JGreenlee/rewrite-services-sept2023' in…

    …to expand-enketo-helper
    Abby Wheelis committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    5d6fb5a View commit details
    Browse the repository at this point in the history
  2. draft enketoHelper tests

    Abby Wheelis committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    0815334 View commit details
    Browse the repository at this point in the history
  3. convert answer.js into enketoHelper

    moving the methods form answer.js into enketoHelper as a part of the services migration
    Abby Wheelis committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    43b8386 View commit details
    Browse the repository at this point in the history
  4. exclude platforms

    When testing, I was getting an error from Jest about duplicate modules, one of which was in platforms. This change resolves that error
    Abby Wheelis committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    9840b5a View commit details
    Browse the repository at this point in the history
  5. add more tests

    additional test for filterByNameAndVersion
    
    fake answers have been constructed to be filtered
    Abby Wheelis committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    1eaf8b8 View commit details
    Browse the repository at this point in the history
  6. remove answer.js

    completely remove answer.js and all references to it, replace references with references to enketoHelper.ts
    Abby Wheelis committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    74b8471 View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2023

  1. adding tests for resolveTimestamps

    resolveTimestamps is a helper function to saveResponse, but still contains a fair amount of its own logic. Testing the edge cases for this function ensures that it will behave as expected within the larger context
    Abby Wheelis committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    d259799 View commit details
    Browse the repository at this point in the history
  2. testing for _lazyLoadConfig

    adding a basic test for _loadLazyConfig, in order to ensure that my mock setup for that works, before moving into testing functions that depend on it
    Abby Wheelis committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    11a3df6 View commit details
    Browse the repository at this point in the history
  3. attempting to add more tests

    currently struggling with i18next and MessageFormat, as I can't get either of those mocked and working
    Abby Wheelis committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    bc42845 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2023

  1. update messageformat plugin

    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    608d97d View commit details
    Browse the repository at this point in the history
  2. start to configure i18next for tests

    setting __DEV__ to false in globals, so that it can be used throught the testing suit
    
    calling the i18n setup in the tests should work once we incorporate the React testing changes
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    8b901f6 View commit details
    Browse the repository at this point in the history
  3. update the message format import

    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    cea96dd View commit details
    Browse the repository at this point in the history
  4. updates to testing

    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    b7f6d68 View commit details
    Browse the repository at this point in the history
  5. updates to tests

    remove old i18n code, update types, comment out broken tests
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    75a0371 View commit details
    Browse the repository at this point in the history
  6. update types

    from log statements, these answers have data and metadata, no labels
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    09f21bc View commit details
    Browse the repository at this point in the history
  7. merge changes from e-mission#1049

    ensured that tests still pass
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    496eeb5 View commit details
    Browse the repository at this point in the history
  8. don't mock i18n, use the real thing

    with the changes from e-mission#1049, we are now able to test using i18n, no need to mock!
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    e7fe7a8 View commit details
    Browse the repository at this point in the history
  9. set up baseline testing for resolveLabels

    introduced i18next for the tests
    
    updated config in mock, and test of loading config to be accurate to what is expected (missing some '{' )
    
    adjust formatting of function indentation
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    70f98cd View commit details
    Browse the repository at this point in the history
  10. rework getInstanceStr tests

    now that I understand how this function works, I got the xml (filled and unfilled) directly from console.log statements. The tests are now accurate, and cover each of the cases.
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    719403a View commit details
    Browse the repository at this point in the history
  11. tests for saveResponse

    testing for saving the response, both when it works and when the  timestamps are invalid, resulting in an error
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    252e42f View commit details
    Browse the repository at this point in the history
  12. take out old console.log

    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    9dc9384 View commit details
    Browse the repository at this point in the history
  13. update types

    based on looking at these variables in breakpoints, these typings are more accurate
    Abby Wheelis committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    4d24d3e View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. carry through async nature of the label functions

    Abby Wheelis committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    1977258 View commit details
    Browse the repository at this point in the history
  2. correct precision of enketo dates

    the mismatch of precision and expected precision here is what was causing the added time entries to fail
    Abby Wheelis committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    a269a55 View commit details
    Browse the repository at this point in the history
  3. resolve vscode errors

    there were errors because I was accessing with window.cordova instead of window['cordova']
    Abby Wheelis committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    e12ee3d View commit details
    Browse the repository at this point in the history
  4. update test

    after the change from miliseconds to seconds, the expected output here changed
    
    e-mission#1063 (comment)
    Abby Wheelis committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    ff30d32 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0346ac0 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    d38745b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c05b204 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Configuration menu
    Copy the full SHA
    4435e99 View commit details
    Browse the repository at this point in the history
  2. move the declaration of _config

    Abby Wheelis committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    6ef2725 View commit details
    Browse the repository at this point in the history
  3. move the fake config, add on

    Moving the fake config into it's own file so that we can easily add onto it. I kept the survey portion that I set up for the enketoHelper tests, and added the rest of the sections found in a typical config.
    
    e-mission#1063 (comment)
    Abby Wheelis committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    b480279 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2023

  1. resolve merge conflicts by merging upstream

    Abby Wheelis committed Oct 20, 2023
    Configuration menu
    Copy the full SHA
    1138d29 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Merge remote-tracking branch 'upstream/service_rewrite_2023' into exp…

    …and-enketo-helper
    Abby Wheelis committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    9c700df View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2023

  1. merge upstream, resolve conflicts, verify tests

    Abby Wheelis committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    ee4b390 View commit details
    Browse the repository at this point in the history
  2. merge in prettier changes, resolve conflicts, run again locally

    verified that jest tests still run
    Abby Wheelis committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    09021f7 View commit details
    Browse the repository at this point in the history
  3. Merge remote-tracking branch 'upstream/service_rewrite_2023' into exp…

    …and-enketo-helper
    Abby Wheelis committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    01f8d2a View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Configuration menu
    Copy the full SHA
    3af741c View commit details
    Browse the repository at this point in the history
  2. support client-side transformation for enketo XMLs

    With this change, the `formPath` specifying the URL of an Enketo survey can be either JSON or XML.
    If it's JSON, we'll be able parse and use it directly. If it cannot be parsed as JSON, we'll perform XML -> JSON transformation with enketo-transformer/web.
    JGreenlee committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    159d665 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2b72850 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2023

  1. merge upstream, resolve conflicts

    Abby Wheelis committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    1008f58 View commit details
    Browse the repository at this point in the history
  2. prettify merge conflicted file

    Abby Wheelis committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    e230420 View commit details
    Browse the repository at this point in the history
  3. add exception to transform

    the enketoHelper tests were failing because one of the files in the added directory was not transpiled ,so it was picking up as bad syntax
    Abby Wheelis committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    da4947d View commit details
    Browse the repository at this point in the history
  4. merge upstream, resolve, test

    Abby Wheelis committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    7521f67 View commit details
    Browse the repository at this point in the history
  5. lingering merge conflict

    this file does not exist in this branch!
    Abby Wheelis committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    2459821 View commit details
    Browse the repository at this point in the history
  6. re-run prettier after merging

    Abby Wheelis committed Nov 10, 2023
    Configuration menu
    Copy the full SHA
    0890e23 View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2023

  1. Configuration menu
    Copy the full SHA
    b33ce28 View commit details
    Browse the repository at this point in the history
  2. cleanup enketo after merge

    - Restore the use of 'filterByNameAndVersion' for trip confim surveys (not currently used for anything else). If a survey response is no longer compatible according to the appConfig, it should be filtered out here.
    - Make the terminology unambiguous such that "answer" means how the user answered a particular question within the survey, and "response" means the overall survey response
    - Clean up / clarify comments
    - Remove unused import statements
    JGreenlee committed Nov 13, 2023
    Configuration menu
    Copy the full SHA
    7df44e9 View commit details
    Browse the repository at this point in the history
  3. test remaining function

    now that Unified Data Loader has been merged, we can test this function, may benefit from more end-to-end testing later, as it relies on the usercache plugin heavily
    Abby Wheelis committed Nov 13, 2023
    Configuration menu
    Copy the full SHA
    4499e24 View commit details
    Browse the repository at this point in the history
  4. re-run prettier

    Abby Wheelis committed Nov 13, 2023
    Configuration menu
    Copy the full SHA
    4a000fc View commit details
    Browse the repository at this point in the history
  5. fix issue with filter

    The root of the issue I was having is that filterByNameAndVersion returns a promise, but it was being assigned to the unprocessedLabels var before the promise was fulfilled, adding the fiter.then() flow resolved this
    Abby Wheelis committed Nov 13, 2023
    Configuration menu
    Copy the full SHA
    ebaa1e6 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2023

  1. add a test case

    we also want to test that the timestamps follow the "minute" accuracy convention we implemented, so that if the survey and timelineEntry match within the minute, we use the timelineEntry timestamps, else use the timestamps from the survey e-mission#1063 (comment)
    Abby Wheelis committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    8f7c674 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2023

  1. note the issue

    this form is invalide because of the start and end times mismatching
    Abby Wheelis committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    7ec575e View commit details
    Browse the repository at this point in the history
  2. check for key before resolving with this information

    Abby Wheelis committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    8b3ab76 View commit details
    Browse the repository at this point in the history
  3. remove _lazyLoadConfig, move types

    the function was not all that necessary, so I removed it
    
    Also moved my survey config type into the appropriate place
    
    e-mission#1063 (comment)
    Abby Wheelis committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    d123b4f View commit details
    Browse the repository at this point in the history
  4. test the version

    adding a response that should get filtered out because the version is too low e-mission#1063 (comment)
    Abby Wheelis committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    100eefb View commit details
    Browse the repository at this point in the history
  5. make config a parameter to mockBEMUserCache

    Abby Wheelis committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    22decbf View commit details
    Browse the repository at this point in the history
  6. more test cases!!

    Because of the new parameter, I was able to add more test cases to resolve Labels
    
    I needed to also clear the locally stored config out of dynamicConfig.ts
    Abby Wheelis committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    80aa5ea View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2023

  1. add survey_info to the AppConfig Type

    from @JGreenlee's suggestion in review
    
    Co-authored-by: Jack Greenlee <JackAGreenlee@gmail.com>
    Abby-Wheelis and JGreenlee authored Nov 19, 2023
    Configuration menu
    Copy the full SHA
    0ef1db8 View commit details
    Browse the repository at this point in the history
  2. make config optional param

    not all (in fact many) of the tests don't need this config at all, so the parameter should be optional to clean things up
    
    Co-authored-by: Jack Greenlee <JackAGreenlee@gmail.com>
    Abby-Wheelis and JGreenlee authored Nov 19, 2023
    Configuration menu
    Copy the full SHA
    10b9546 View commit details
    Browse the repository at this point in the history
  3. fallback to fakeConfig

    follow-on to making the config an optional parameter to mockBEMUserCache
    
    Instead of passing it in EVERY TIME, it is now a fallback, and the config only needs to be specified and re-specified in the enketoHelper tests
    
    added fallback and removed specification from tests that didn't need it
    Abby Wheelis committed Nov 19, 2023
    Configuration menu
    Copy the full SHA
    fd01034 View commit details
    Browse the repository at this point in the history
  4. prettier types

    Abby Wheelis committed Nov 19, 2023
    Configuration menu
    Copy the full SHA
    83a773e View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2023

  1. enketoHelper: expand typings for resolveTimestamps

    -add types for the parameters of resolveTimestamps
    -update doc of this function
    -cast 'timelineEntry' to trip or place where needed
    -add a few fields that were missing from type defs of ConfirmedPlace and EnketoSurveyConfig
    JGreenlee committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    becc4af View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2023

  1. enketoHelper: fix error if timestamps are null

    if the survey doesn't use start and end times, timestamps will be null. This is fine and we can use optional chaining to prevent throwing an error here
    JGreenlee committed Nov 21, 2023
    Configuration menu
    Copy the full SHA
    828ee12 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e414c5c View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2023

  1. Configuration menu
    Copy the full SHA
    aee8738 View commit details
    Browse the repository at this point in the history

Commits on Dec 3, 2023

  1. Configuration menu
    Copy the full SHA
    b900d1e View commit details
    Browse the repository at this point in the history