Private
Public Access
1
0

Merge branch 'release/v6.18'

This commit is contained in:
Sander Roosendaal
2018-03-14 11:13:11 +01:00
7 changed files with 120 additions and 13 deletions

View File

@@ -324,7 +324,6 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
except KeyError:
pass
# protect 0 spm values from being nulled
try:
datadf['spm'] = datadf['spm'] + 1.0
@@ -386,6 +385,7 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
except KeyError:
pass
try:
mask = datadf['pace'] / 1000. > 300.
datadf.loc[mask, 'pace'] = np.nan
@@ -1699,7 +1699,9 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True):
if doclean:
data = clean_df_stats(data, ignorehr=True,
workstrokesonly=workstrokesonly)
data.dropna(inplace=True,axis=0)
data.dropna(axis=1,how='all',inplace=True)
data.dropna(axis=0,how='any',inplace=True)
return data

View File

@@ -223,6 +223,9 @@ def getcp(dfgrouped,logarr):
mask = rolling_std == 0
ww.loc[mask] = 0
mask = ww > 2000
ww.loc[mask] = 0
tmax = tt.max()
@@ -297,7 +300,7 @@ def getmaxwattinterval(tt,ww,i):
try:
t_0 = tt.ix[indexmax]
t_1 = tt.ix[indexmax-i]
deltas = tt.ix[indexmax-1:indexmax].diff().dropna()
deltas = tt.ix[indexmax-i:indexmax].diff().dropna()
testres = 1.0e-3*deltas.max() < 30.
if testres:
deltat = 1.0e-3*(t_0-t_1)

View File

@@ -0,0 +1,56 @@
#!/srv/venv/bin/python
import sys
import os
# If you find a solution that does not need the two paths, please comment!
sys.path.append('$path_to_root_of_project$')
sys.path.append('$path_to_root_of_project$/$project_name$')
os.environ['DJANGO_SETTINGS_MODULE'] = '$project_name$.settings'
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.core.mail import send_mail, BadHeaderError,EmailMessage
import datetime
from rowers.models import *
from rowsandall_app.settings import BASE_DIR
import pandas as pd
def getemails():
rs = Rower.objects.all()
firstnames = [r.user.first_name for r in rs]
lastnames = [r.user.last_name for r in rs]
emails = [r.user.email for r in rs]
is_actives = [r.user.is_active for r in rs]
df = pd.DataFrame({
'first_name':firstnames,
'last_name':lastnames,
'email':emails,
'is_active':is_actives
})
return df
class Command(BaseCommand):
def handle(self, *args, **options):
email_list = getemails()
email_list.to_csv('email_list.csv')
fullemail = 'roosendaalsander@gmail.com'
subject = "Rowsandall users list"
message = "Dear Sander,\n\n"
message += "Best Regards, the Rowsandall Team"
message += "Users list attached \n\n"
email = EmailMessage(subject, message,
'Rowsandall <info@rowsandall.com>',
[fullemail])
email.attach_file('email_list.csv')
os.remove('email_list.csv')
res = email.send()

View File

@@ -173,7 +173,6 @@ def update_records(url=c2url):
df['Distance'] = df['Event']
df['Duration'] = 0
print row.Duration
for nr,row in df.iterrows():
if 'm' in row['Record']:
df.ix[nr,'Distance'] = row['Record'][:-1]

View File

@@ -1,7 +1,8 @@
<h2>Personal information collection</h2>
<p>
At rowsandall.com we take your privacy very seriously. IN order to provide access
At rowsandall.com we take your privacy very seriously.
In order to provide access
to the service we must collect and store some personal information about you.
</p>

View File

@@ -26,7 +26,8 @@
<div id="right" class="grid_6 omega">
<ul>
<li>Team Type: A private team is invisible on the Teams Management page, except for its members. The only way to add members is for the manager to send an invitation. An open team is visible for all rowsandall.com users. In addition to the invitation mechanism, any user can request to be added to this team. The team manager will always have to approve membership.</li>
<li>Sharing Behavior: When set to "All Members", all members of a team will see each other's workouts. This is the recommended setting. If te sharing bhavior is set to "Coach Only", team members only see their own workouts. The coach sees all team members' workouts.</li>
<li>Sharing Behavior: When set to "All Members", all members of a team will see each other's workouts. This is the recommended setting.
If the sharing behavior is set to "Coach Only", team members only see their own workouts. The coach sees all team members' workouts.</li>
<li>These settings can be changed at any point in time through the Team Edit page</li>
</ul>
</div>

View File

@@ -4194,10 +4194,23 @@ def otwrankings_view(request,theuser=0,
startdate = enddate-datetime.timedelta(days=int(deltadays))
if startdatestring != "":
startdate = iso8601.parse_date(startdatestring)
try:
startdate = iso8601.parse_date(startdatestring)
except ParseError:
pass
if enddatestring != "":
enddate = iso8601.parse_date(enddatestring)
try:
enddate = iso8601.parse_date(enddatestring)
except ParseError:
pass
if 'startdate' in request.session:
startdate = iso8601.parse_date(request.session['startdate'])
if 'enddate' in request.session:
enddate = iso8601.parse_date(request.session['enddate'])
if enddate < startdate:
s = enddate
@@ -4243,7 +4256,10 @@ def otwrankings_view(request,theuser=0,
'enddate': enddate,
})
else:
dateform = DateRangeForm()
dateform = DateRangeForm(initial={
'startdate': startdate,
'enddate': enddate,
})
deltaform = DeltaDaysForm()
else:
@@ -4418,6 +4434,11 @@ def otwrankings_view(request,theuser=0,
del form.fields["pieceunit"]
startdatestring = startdate.strftime('%Y-%m-%d')
enddatestring = enddate.strftime('%Y-%m-%d')
request.session['startdate'] = startdatestring
request.session['enddate'] = enddatestring
messages.error(request,message)
return render(request, 'otwrankings.html',
{'rankingworkouts':theworkouts,
@@ -4435,6 +4456,7 @@ def otwrankings_view(request,theuser=0,
'teams':get_my_teams(request.user),
'workouttype':'water',
})
# Show ranking distances including predicted paces
@user_passes_test(ispromember,login_url="/",redirect_field_name=None)
def oterankings_view(request,theuser=0,
@@ -4448,10 +4470,23 @@ def oterankings_view(request,theuser=0,
startdate = enddate-datetime.timedelta(days=int(deltadays))
if startdatestring != "":
startdate = iso8601.parse_date(startdatestring)
try:
startdate = iso8601.parse_date(startdatestring)
except ParseError:
pass
if enddatestring != "":
enddate = iso8601.parse_date(enddatestring)
try:
enddate = iso8601.parse_date(enddatestring)
except ParseError:
pass
if 'startdate' in request.session:
startdate = iso8601.parse_date(request.session['startdate'])
if 'enddate' in request.session:
enddate = iso8601.parse_date(request.session['enddate'])
if enddate < startdate:
s = enddate
@@ -4497,7 +4532,10 @@ def oterankings_view(request,theuser=0,
'enddate': enddate,
})
else:
dateform = DateRangeForm()
dateform = DateRangeForm(initial={
'startdate': startdate,
'enddate': enddate,
})
deltaform = DeltaDaysForm()
else:
@@ -4751,6 +4789,13 @@ def oterankings_view(request,theuser=0,
# del form.fields["pieceunit"]
startdatestring = startdate.strftime('%Y-%m-%d')
enddatestring = enddate.strftime('%Y-%m-%d')
request.session['startdate'] = startdatestring
request.session['enddate'] = enddatestring
messages.error(request,message)
return render(request, 'oterankings.html',
{'rankingworkouts':theworkouts,
@@ -12068,7 +12113,7 @@ def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0):
try:
fstartdate = arrow.get(request.session['fstartdate']).date()
except KeyError:
fastartdate = timezone.now().date()
fstartdate = timezone.now().date()
try:
fenddate = arrow.get(request.session['fenddate']).date()
except KeyError: