diff --git a/rowers/tests/test_unit_tests.py b/rowers/tests/test_unit_tests.py index a8b6df56..9fd5c5a1 100644 --- a/rowers/tests/test_unit_tests.py +++ b/rowers/tests/test_unit_tests.py @@ -173,12 +173,14 @@ class PlannedSessionTests(TestCase): self.target.rowers.add(self.u.rower) self.target.save() + thismonthbegin = datetime.date(timezone.now().year,timezone.now().month,1) + self.plan = TrainingPlan.objects.create( manager = self.u.rower, name = faker.word(), status=True, target = self.target, - startdate=timezone.now().date(), + startdate=thismonthbegin, enddate = self.target.date, ) @@ -213,6 +215,7 @@ class PlannedSessionTests(TestCase): plan=self.macro, name = '%s' % firstday.strftime("%B"), type = 'userdefined') + meso.save() mesos = TrainingMesoCycle.objects.filter(plan=self.macro) diff --git a/rowers/uploads.py b/rowers/uploads.py index 726aeb8b..3044c489 100644 --- a/rowers/uploads.py +++ b/rowers/uploads.py @@ -541,6 +541,7 @@ def do_sync(w,options, quick=False): except KeyError: pass + try: if options['nkid'] != 0 and options['nkid'] != '': # pragma: no cover w.uploadedtonk = options['nkid'] @@ -620,8 +621,14 @@ def do_sync(w,options, quick=False): f.write(str(e)) + do_tp_export = w.user.trainingpeaks_auto_export + try: + upload_to_tp = options['upload_to_SportTracks'] or do_tp_export + do_tp_export = upload_to_tp + except KeyError: + upload_to_tp = False - if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export): + if do_tp_export: try: message,id = sporttracksstuff.workout_sporttracks_upload( w.user.user,w,asynchron=True,