Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-10-14 12:49:19 +02:00
parent 4e116e7e03
commit 806d34b2d2
2 changed files with 41 additions and 17 deletions

View File

@@ -9,6 +9,7 @@ import zipfile
from zipfile import BadZipFile
import re
import time
import traceback
from time import strftime
import requests
@@ -192,26 +193,48 @@ class Command(BaseCommand):
failedmailbox = Mailbox.objects.get(name='Failed')
# Polar
polar_available = polarstuff.get_polar_notifications()
res = polarstuff.get_all_new_workouts(polar_available)
try:
polar_available = polarstuff.get_polar_notifications()
res = polarstuff.get_all_new_workouts(polar_available)
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
dologging('processemail.log',''.join('!! ' + line for line in lines))
# Concept2
rowers = Rower.objects.filter(c2_auto_import=True)
for r in rowers: # pragma: no cover
if user_is_not_basic(r.user):
c2stuff.get_c2_workouts(r)
try:
rowers = Rower.objects.filter(c2_auto_import=True)
for r in rowers: # pragma: no cover
if user_is_not_basic(r.user):
c2stuff.get_c2_workouts(r)
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
dologging('processemail.log',''.join('!! ' + line for line in lines))
rowers = Rower.objects.filter(rp3_auto_import=True)
for r in rowers: # pragma: no cover
if user_is_not_basic(r.user):
res = rp3stuff.get_rp3_workouts(r)
rowers = Rower.objects.filter(nk_auto_import=True)
for r in rowers: # pragma: no cover
if user_is_not_basic(r.user):
s = 'Starting NK Auto Import for user {id}'.format(id=r.user.id)
dologging('nklog.log',s)
res = nkstuff.get_nk_workouts(r)
try:
rowers = Rower.objects.filter(rp3_auto_import=True)
for r in rowers: # pragma: no cover
if user_is_not_basic(r.user):
res = rp3stuff.get_rp3_workouts(r)
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
dologging('processemail.log',''.join('!! ' + line for line in lines))
try:
rowers = Rower.objects.filter(nk_auto_import=True)
for r in rowers: # pragma: no cover
if user_is_not_basic(r.user):
s = 'Starting NK Auto Import for user {id}'.format(id=r.user.id)
dologging('nklog.log',s)
res = nkstuff.get_nk_workouts(r)
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
dologging('processemail.log',''.join('!! ' + line for line in lines))
messages = Message.objects.filter(mailbox_id = workoutmailbox.id)
message_ids = [m.id for m in messages]