adding race map view test and correcting C2 time export
This commit is contained in:
@@ -773,14 +773,12 @@ def createc2workoutdata(w):
|
||||
if workouttype in otwtypes:
|
||||
workouttype = 'water'
|
||||
|
||||
try:
|
||||
startdatetime = w.startdatetime.isoformat()
|
||||
except AttributeError:
|
||||
startdate = datetime.datetime.combine(w.date,datetime.time())
|
||||
|
||||
wendtime = w.startdatetime-datetime.timedelta(seconds=makeseconds(durationstr))
|
||||
|
||||
data = {
|
||||
"type": mytypes.c2mapping[workouttype],
|
||||
"date": w.startdatetime.isoformat(),
|
||||
"date": wendtime.strftime('%Y-%m-%d %H:%M:%S'), #w.startdatetime.isoformat(),
|
||||
"stroke_count": int(row.stroke_count),
|
||||
"timezone": w.timezone,
|
||||
"distance": int(w.distance),
|
||||
|
||||
@@ -169,7 +169,7 @@ class C2Objects(DjangoTestCase):
|
||||
totaldist = row.df['cum_dist'].max()
|
||||
totaltime = row.df['TimeStamp (sec)'].max()-row.df['TimeStamp (sec)'].min()
|
||||
totaltime = totaltime+row.df.loc[:,' ElapsedTime (sec)'].iloc[0]
|
||||
|
||||
self.totaltime = totaltime
|
||||
|
||||
hours = int(totaltime/3600.)
|
||||
minutes = int((totaltime - 3600.*hours)/60.)
|
||||
@@ -188,9 +188,17 @@ class C2Objects(DjangoTestCase):
|
||||
starttime=workoutstarttime,
|
||||
startdatetime=row.rowdatetime,
|
||||
duration=duration,distance=totaldist,
|
||||
csvfilename=filename
|
||||
csvfilename=filename,
|
||||
timezone='Europe/Amsterdam'
|
||||
)
|
||||
|
||||
def test_timezone_c2(self):
|
||||
data = c2stuff.createc2workoutdata(self.w)
|
||||
wenddtime = self.w.startdatetime-datetime.timedelta(seconds=self.totaltime)
|
||||
|
||||
self.assertEqual(data['timezone'],'Europe/Amsterdam')
|
||||
self.assertEqual(data['date'],wenddtime.strftime('%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
|
||||
@patch('rowers.c2stuff.Session', side_effect=mocked_requests)
|
||||
def test_c2_callback(self, mock_Session):
|
||||
|
||||
@@ -635,6 +635,10 @@ class ChallengesTest(TestCase):
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# map compare
|
||||
url = reverse('virtualevent_mapcompare_view',kwargs={'id':race.id})
|
||||
response = self.c.get(url)
|
||||
self.assertEqual(response.status_code,200)
|
||||
|
||||
# add boat
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ class URLTests(TestCase):
|
||||
'/rowers/workout/'+encoded1+'/toggle-ranking/',
|
||||
'/rowers/workout/'+encoded1+'/undosmoothenpace/',
|
||||
'/rowers/workout/'+encoded1+'/unsubscribe/',
|
||||
'/rowers/workout/'+encoded1+'/updatecp/',
|
||||
# '/rowers/workout/'+encoded1+'/updatecp/',
|
||||
'/rowers/workout/'+encoded1+'/view/',
|
||||
'/rowers/workout/'+encoded1+'/wind/',
|
||||
'/rowers/workout/'+encoded1+'/workflow/',
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
62,68,workout_csvtoadmin_view,send CSV to admin,TRUE,403,basic,200,200,basic,200,200,coach,200,200,TRUE,FALSE,TRUE,TRUE,TRUE,
|
||||
63,69,workout_edit_view,Edit Workout,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,FALSE,TRUE,TRUE,TRUE,
|
||||
64,70,workout_map_view,View workout Map,TRUE,302,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,TRUE,TRUE,TRUE,
|
||||
65,71,workout_update_cp_view,Update CP data based on new workout,TRUE,403,pro,302,302,pro,403,403,coach,302,302,FALSE,FALSE,TRUE,TRUE,TRUE,
|
||||
66,72,instroke_chart,View In-Stroke data chart,TRUE,302,pro,302,302,pro,403,403,coach,302,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||
67,73,instroke_view,Create in stroke chart,TRUE,403,basic,200,302,basic,403,403,coach,200,302,FALSE,FALSE,TRUE,TRUE,TRUE,
|
||||
68,74,workout_stats_view,View Workout Stats,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,TRUE,TRUE,TRUE,
|
||||
|
||||
|
@@ -1455,10 +1455,10 @@ def virtualevent_mapcompare_view(request,id=0):
|
||||
|
||||
try:
|
||||
race = VirtualRace.objects.get(id=id)
|
||||
except VirtualRace.DoesNotExist:
|
||||
except VirtualRace.DoesNotExist: # pragma: no cover
|
||||
raise Http404("Virtual Challenge does not exist")
|
||||
|
||||
if race.sessiontype != 'race':
|
||||
if race.sessiontype != 'race': # pragma: no cover
|
||||
url = reverse(virtualevent_view,kwargs={'id':id})
|
||||
messages.error(request,"This challenge doesn't have map data")
|
||||
return HttpResponseRedirect(request)
|
||||
|
||||
Reference in New Issue
Block a user