Private
Public Access
1
0

fixing tests

This commit is contained in:
Sander Roosendaal
2021-05-20 21:23:31 +02:00
parent b5660813fa
commit 3d208527ee
4 changed files with 42 additions and 6 deletions

View File

@@ -23,6 +23,15 @@ from json.decoder import JSONDecodeError
from pytz.exceptions import UnknownTimeZoneError
def dologging(s):
tstamp = time.localtime()
timestamp = time.strftime('%b-%d-%Y %H:%M:%S', tstamp)
with open('debuglog.log','a') as f:
f.write('\n')
f.write(timestamp)
f.write(' ')
f.write(s)
from rowsandall_app.settings import (
C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET,
UPLOAD_SERVICE_URL, UPLOAD_SERVICE_SECRET
@@ -695,7 +704,7 @@ def createc2workoutdata(w):
workouttype = 'water'
wendtime = w.startdatetime-datetime.timedelta(seconds=makeseconds(durationstr))
wendtime = w.startdatetime+datetime.timedelta(seconds=makeseconds(durationstr))
data = {
"type": mytypes.c2mapping[workouttype],
@@ -1018,7 +1027,9 @@ def workout_c2_upload(user,w,asynchron=False):
if not c2userid: # pragma: no cover
raise NoTokenError("User has no token")
dologging('Upload to C2 user {userid}'.format(userid=user.id))
data = createc2workoutdata(w)
dologging(json.dumps(data))
if data == 0: # pragma: no cover
return "Error: No data file. Contact info@rowsandall.com if the problem persists",0