fix stats by week
This commit is contained in:
parent
54375e0576
commit
88382d72d5
2
Makefile
2
Makefile
@ -67,7 +67,7 @@ test-e2e: init-db
|
|||||||
$(NPM) test
|
$(NPM) test
|
||||||
|
|
||||||
test-python:
|
test-python:
|
||||||
$(PYTEST) fittrackee_api --cov-config .coveragerc --cov=fittrackee_api --cov-report term-missing
|
$(PYTEST) fittrackee_api --cov-config .coveragerc --cov=fittrackee_api --cov-report term-missing $(PYTEST_ARGS)
|
||||||
|
|
||||||
test-python-xml:
|
test-python-xml:
|
||||||
$(PYTEST) fittrackee_api --cov-config .coveragerc --cov=fittrackee_api --cov-report xml
|
$(PYTEST) fittrackee_api --cov-config .coveragerc --cov=fittrackee_api --cov-report xml
|
||||||
|
@ -76,7 +76,9 @@ def get_activities(user_id, filter_type):
|
|||||||
else:
|
else:
|
||||||
if time == 'week':
|
if time == 'week':
|
||||||
activity_date = activity.activity_date - timedelta(
|
activity_date = activity.activity_date - timedelta(
|
||||||
days=activity.activity_date.isoweekday()
|
days=(activity.activity_date.isoweekday()
|
||||||
|
if activity.activity_date.isoweekday() < 7
|
||||||
|
else 0)
|
||||||
)
|
)
|
||||||
time_period = datetime.strftime(activity_date, "%Y-%m-%d")
|
time_period = datetime.strftime(activity_date, "%Y-%m-%d")
|
||||||
elif time == 'weekm': # week start Monday
|
elif time == 'weekm': # week start Monday
|
||||||
|
@ -684,7 +684,7 @@ def test_get_stats_by_week_all_activities(
|
|||||||
'total_duration': 1600
|
'total_duration': 1600
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'2018-03-25':
|
'2018-04-01':
|
||||||
{
|
{
|
||||||
'1':
|
'1':
|
||||||
{
|
{
|
||||||
@ -738,7 +738,7 @@ def test_get_stats_by_week_all_activities_week_13(
|
|||||||
assert 'success' in data['status']
|
assert 'success' in data['status']
|
||||||
assert data['data']['statistics'] == \
|
assert data['data']['statistics'] == \
|
||||||
{
|
{
|
||||||
'2018-03-25':
|
'2018-04-01':
|
||||||
{
|
{
|
||||||
'1':
|
'1':
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user