adding extra log
This commit is contained in:
@@ -41,7 +41,7 @@ def time_in_path(df,p,maxmin='max',getall=False,name='unknown',logfile=None):
|
|||||||
if logfile is not None:
|
if logfile is not None:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(' ')
|
||||||
@@ -65,7 +65,7 @@ def time_in_path(df,p,maxmin='max',getall=False,name='unknown',logfile=None):
|
|||||||
if logfile is not None:
|
if logfile is not None:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(' ')
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
|||||||
e = sys.exc_info()[0]
|
e = sys.exc_info()[0]
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||||
with open('stravalog.log','a') as f:
|
with open('stravalog.log','ab') as f:
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(str(e))
|
f.write(str(e))
|
||||||
@@ -446,7 +446,7 @@ def handle_check_race_course(self,
|
|||||||
try:
|
try:
|
||||||
entrytimes,entrydistances = time_in_path(rowdata,paths[0],maxmin='max',getall=True,
|
entrytimes,entrydistances = time_in_path(rowdata,paths[0],maxmin='max',getall=True,
|
||||||
name=polygons[0].name,logfile=logfile)
|
name=polygons[0].name,logfile=logfile)
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
@@ -471,7 +471,7 @@ def handle_check_race_course(self,
|
|||||||
endseconds = []
|
endseconds = []
|
||||||
|
|
||||||
for startt in entrytimes:
|
for startt in entrytimes:
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
@@ -594,17 +594,19 @@ def handle_check_race_course(self,
|
|||||||
engine.dispose()
|
engine.dispose()
|
||||||
|
|
||||||
# add times for all gates to log file
|
# add times for all gates to log file
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(' ')
|
||||||
f.write('--- LOG of all gate times---')
|
f.write('--- LOG of all gate times---')
|
||||||
|
|
||||||
for path,polygon in (paths,polygons):
|
for path,polygon in zip(paths,polygons):
|
||||||
( secs,meters,completed) = coursetime_paths(rowdata2,
|
( secs,meters,completed) = coursetime_paths(rowdata2,
|
||||||
[path],[polygon],logfile=logfile)
|
[path],polygons=[polygon],logfile=logfile)
|
||||||
|
with open(logfile,'ab') as f:
|
||||||
|
line = " time: {t} seconds, distance: {m} meters".format(t=secs,m=meters)
|
||||||
|
f.write(line)
|
||||||
|
|
||||||
# send email
|
# send email
|
||||||
handle_sendemail_coursefail(
|
handle_sendemail_coursefail(
|
||||||
|
|||||||
@@ -1036,26 +1036,19 @@ def garmin_deregistration_view(request):
|
|||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
return HttpResponse(status=200)
|
return HttpResponse(status=200)
|
||||||
|
|
||||||
t = time.localtime()
|
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
|
||||||
with open('garminlog.log','a') as f:
|
|
||||||
f.write('\n')
|
|
||||||
f.write(timestamp)
|
|
||||||
f.write(' ')
|
|
||||||
f.write(str(request.body))
|
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
|
deregistrations = data['deregistrations']
|
||||||
|
for deregistration in deregistrations:
|
||||||
try:
|
try:
|
||||||
garmintoken = data['userAccessToken']
|
garmintoken = deregistration['userAccessToken']
|
||||||
except KeyError:
|
|
||||||
print(data)
|
|
||||||
return HttpResponse(status=200)
|
|
||||||
try:
|
try:
|
||||||
r = Rower.objects.get(garmintoken=garmintoken)
|
r = Rower.objects.get(garmintoken=garmintoken)
|
||||||
r.garmintoken = ''
|
r.garmintoken = ''
|
||||||
r.save()
|
r.save()
|
||||||
except Rower.DoesNotExist:
|
except Rower.DoesNotExist:
|
||||||
return HttpResponse(status=200)
|
pass
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
return HttpResponse(status=200)
|
return HttpResponse(status=200)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user