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

🛂 Support the new config for auto versus pre-generated tokens #918

Merged

Conversation

shankari
Copy link
Contributor

If the opcode field is present in the config, use it to determine whether the tokens should be auto-generated or pre-generated.

If it is not, fall back to the old study vs program check. We should remove the backwards compat code after all old-style configs have been removed

Testing done:

  • Added new test with new style config
  • Added new test for old style config that returns token list
  • All tests pass
$ ./e-mission-py.bash emission/tests/netTests/TestWebServer.py
storage not configured, falling back to sample, default configuration
URL not formatted, defaulting to "Stage_database"
Connecting to database URL localhost
analysis.debug.conf.json not configured, falling back to sample, default configuration
ERROR:root:habitica not configured, game functions not supported
Traceback (most recent call last):
  File "/Users/kshankar/e-mission/gis_branch_tests/emission/net/ext_service/habitica/proxy.py", line 22, in <module>
    key_file = open('conf/net/ext_service/habitica.json')
FileNotFoundError: [Errno 2] No such file or directory: 'conf/net/ext_service/habitica.json'
Finished configuring logging for <RootLogger root (WARNING)>
Finished configuring logging for <RootLogger root (WARNING)>
.Finished configuring logging for <RootLogger root (WARNING)>
.Finished configuring logging for <RootLogger root (WARNING)>
.
----------------------------------------------------------------------
Ran 3 tests in 0.735s

OK

We should check whether a single string is in the data, not a list.

Testing done:
- without this change, running the intake pipeline on a test user generates the error

```
Error while creating composite objects, timestamp is unchanged
Traceback (most recent call last):
  File "/Users/kshankar/e-mission/gis_branch_tests/emission/analysis/plotting/composite_trip_creation.py", line 139, in create_composite_objects
    last_done_ts = create_composite_trip(ts, t)
  File "/Users/kshankar/e-mission/gis_branch_tests/emission/analysis/plotting/composite_trip_creation.py", line 36, in create_composite_trip
    elif "additions" in ct["data"] and ["trip_addition"] in ct["data"]:
TypeError: unhashable type: 'list'
```

The user does not show any trips in the label screen.

- with this change, the intake pipeline runs correctly without errors
The user trips are visible in the label screen

This fixes: e-mission/e-mission-docs#903 (comment)
Verified that these are in fact intermediate style trips:
e-mission/e-mission-docs#903 (comment)
e-mission/e-mission-docs#903 (comment)
…ation_intermediate_format

🚑 use string while check for field in "data"
If the `opcode` field is present in the config, use it to determine whether the
tokens should be auto-generated or pre-generated.

If it is not, fall back to the old study vs program check.
We should remove the backwards compat code after all old-style configs have been removed

Testing done:
- Added new test with new style config
- Added new test for old style config that returns token list
- All tests pass

```
$ ./e-mission-py.bash emission/tests/netTests/TestWebServer.py
storage not configured, falling back to sample, default configuration
URL not formatted, defaulting to "Stage_database"
Connecting to database URL localhost
analysis.debug.conf.json not configured, falling back to sample, default configuration
ERROR:root:habitica not configured, game functions not supported
Traceback (most recent call last):
  File "/Users/kshankar/e-mission/gis_branch_tests/emission/net/ext_service/habitica/proxy.py", line 22, in <module>
    key_file = open('conf/net/ext_service/habitica.json')
FileNotFoundError: [Errno 2] No such file or directory: 'conf/net/ext_service/habitica.json'
Finished configuring logging for <RootLogger root (WARNING)>
Finished configuring logging for <RootLogger root (WARNING)>
.Finished configuring logging for <RootLogger root (WARNING)>
.Finished configuring logging for <RootLogger root (WARNING)>
.
----------------------------------------------------------------------
Ran 3 tests in 0.735s

OK
```
@shankari
Copy link
Contributor Author

shankari commented May 20, 2023

Related join webapp: e-mission/nrel-openpath-join-page#13
Related phone changes: e-mission/e-mission-phone#973

This should be the final piece for fixing e-mission/e-mission-docs#850 (comment)

@shankari shankari changed the base branch from master to may_2023_point_release May 20, 2023 15:01
@shankari shankari merged commit f2b5637 into e-mission:may_2023_point_release May 20, 2023
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.

1 participant