adding automatic charting
This commit is contained in:
@@ -764,6 +764,14 @@ class Rower(models.Model):
|
||||
(365,'a year')
|
||||
)
|
||||
|
||||
plotchoices = (
|
||||
('timeplot','Time Plot'),
|
||||
('distanceplot','Distance Plot'),
|
||||
('pieplot','Heart Rate Pie Chart'),
|
||||
('hrpieplot','Power Pie Chart'),
|
||||
('None','None'),
|
||||
)
|
||||
|
||||
user = models.OneToOneField(User,on_delete=models.CASCADE)
|
||||
|
||||
#billing details
|
||||
@@ -969,6 +977,10 @@ class Rower(models.Model):
|
||||
slowpaceotw = models.DurationField(default=otwpaceslow,verbose_name='Slowest OTW Pace')
|
||||
fastpaceotw = models.DurationField(default=otwpacefast,verbose_name='Fastest OTW Pace')
|
||||
|
||||
staticchartonupload = models.CharField(default='None',choices=plotchoices,
|
||||
max_length=100,
|
||||
verbose_name='Generate a static chart automatically on upload')
|
||||
|
||||
# Auto Join
|
||||
autojoin = models.BooleanField(default=False,verbose_name='Auto Join Workout Segments')
|
||||
|
||||
@@ -3001,7 +3013,7 @@ def auto_delete_file_on_delete(sender, instance, **kwargs):
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
@receiver(models.signals.post_delete,sender=Workout)
|
||||
def update_duplicates_on_delete(sender, instance, **kwargs):
|
||||
@@ -3790,7 +3802,7 @@ class AccountRowerForm(ModelForm):
|
||||
class StaticChartRowerForm(ModelForm):
|
||||
class Meta:
|
||||
model = Rower
|
||||
fields = ['staticgrids','slowpaceerg','fastpaceerg','slowpaceotw','fastpaceotw']
|
||||
fields = ['staticgrids','slowpaceerg','fastpaceerg','slowpaceotw','fastpaceotw','staticchartonupload']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(StaticChartRowerForm, self).__init__(*args, **kwargs)
|
||||
|
||||
@@ -245,6 +245,7 @@ def rower_favoritecharts_view(request,userid=0):
|
||||
r.fastpaceerg = staticchartform.cleaned_data.get('fastpaceerg')
|
||||
r.slowpaceotw = staticchartform.cleaned_data.get('slowpaceotw')
|
||||
r.fastpaceotw = staticchartform.cleaned_data.get('fastpaceotw')
|
||||
r.staticchartonupload = staticchartform.cleaned_data.get('staticchartonupload')
|
||||
r.save()
|
||||
|
||||
if request.method == 'POST' and 'form-TOTAL_FORMS' in request.POST:
|
||||
|
||||
@@ -4793,6 +4793,9 @@ def workout_upload_api(request):
|
||||
|
||||
if make_plot:
|
||||
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||
elif r.staticchartonupload != 'None':
|
||||
plottype = r.staticchartonupload
|
||||
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||
|
||||
uploads.do_sync(w,post_data,quick=True)
|
||||
|
||||
@@ -5101,6 +5104,9 @@ def workout_upload_view(request,
|
||||
request.session['async_tasks'] += [(jobid,'make_plot')]
|
||||
except KeyError:
|
||||
request.session['async_tasks'] = [(jobid,'make_plot')]
|
||||
elif r.staticchartonupload != None:
|
||||
plottype = r.staticchartonupload
|
||||
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||
|
||||
# upload to C2
|
||||
if (upload_to_c2):
|
||||
|
||||
Reference in New Issue
Block a user