SuccessChanges

Summary

  1. Fix regression caused by switch to standard function (commit: d865b6e8a9e42c7a5b06311409c438b705ac4621) (details)
Commit d865b6e8a9e42c7a5b06311409c438b705ac4621 by shankari
Fix regression caused by switch to standard function
In
https://github.com/e-mission/e-mission-server/commit/c26ebf6ed6c8c54ce3dbdc715d03ae869e066e53,
we changed the fix from
https://github.com/e-mission/e-mission-server/commit/4aa521caa2bab3c4a3802b210c6a0fa5f7e25d68
to use the standard library to write to both the usercache and the time
series.
Unfortunately, we didn't test after that :( This fixes the related
regression.
Also, while running the test after this, we ran into issues with loading
some of the test data since it contained entries for
`background/filtered_location_ignore` which is not a valid entry
according to our data model (`emission/core/wrapper/entry.py`).
So we removed the entries from the file. The data now loads
successfully.
```
$ ./e-mission-py.bash bin/debug/load_timeline_for_day_and_user.py
emission/tests/data/real_examples/shankari_2015-07-22 test_july_22
storage not configured, falling back to sample, default configuration
Connecting to database URL localhost
emission/tests/data/real_examples/shankari_2015-07-22 Loading file
emission/tests/data/real_examples/shankari_2015-07-22 After
registration, test_july_22 -> 2b8d7eb9-d80a-4e0c-b089-af8e271448b6
Finished loading 0 entries into the usercache and 1906 entries into the
timeseries
```
``` In [1]: import json
In [2]: july_22_entries =
json.load(open("emission//tests/data/real_examples/shankari_20
  ...: 15-07-22"))
In [3]: len(july_22_entries) Out[3]: 2187
In [4]: non_ignored_entries = [e for e in july_22_entries if
e["metadata"]["key"] != 'ba
  ...: ckground/filtered_location_ignore']
In [5]: len(non_ignored_entries) Out[5]: 1906
In [6]: json.dump(non_ignored_entries,
  ...: open("emission/tests/data/real_examples/shankari_2015-07-22",
  ...: "w"), indent=4)
```
``` In [7]: is_sorted = [e1["data"]["ts"] < e2["data"]["ts"] for (e1,
e2) in zip(non_ignored
  ...: _entries, non_ignored_entries[1:])]
In [8]: for i, x in enumerate(is_sorted):
  ...:     if not x:
  ...:         print("Found false value at index %d" % i) Found false
value at index 432 Found false value at index 756 Found false value at
index 822 Found false value at index 858 Found false value at index 896
Found false value at index 1092
```
Oh noes!! the filtered entries are not sorted
``` In [9]: is_sorted_unignored = [e1["data"]["ts"] < e2["data"]["ts"]
for (e1, e2) in zip(j
  ...: uly_22_entries, july_22_entries[1:])]
In [10]: for i, x in enumerate(is_sorted_unignored):
   ...:     if not x:
   ...:         print("Found false value at index %d" % i) Found false
value at index 437 Found false value at index 630 Found false value at
index 1037 Found false value at index 1103 Found false value at index
1139 Found false value at index 1177 Found false value at index 1373
```
But is is OK - the original values are not sorted either...
(commit: d865b6e8a9e42c7a5b06311409c438b705ac4621)
The file was modifiedemission/tests/data/real_examples/shankari_2015-07-22 (diff)
The file was modifiedbin/debug/load_timeline_for_day_and_user.py (diff)