passing tests - views.py split over multiple files
This commit is contained in:
@@ -103,9 +103,9 @@ from rowers.models import (
|
||||
FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement,BasePlannedSessionFormSet,
|
||||
get_course_timezone
|
||||
)
|
||||
from rowers.metrics import rowingmetrics,defaultfavoritecharts
|
||||
from rowers import metrics
|
||||
from rowers import courses
|
||||
from rowers.metrics import rowingmetrics,defaultfavoritecharts,nometrics
|
||||
from rowers import metrics as metrics
|
||||
from rowers import courses as courses
|
||||
import rowers.uploads as uploads
|
||||
from django.forms.formsets import formset_factory
|
||||
from django.forms import modelformset_factory
|
||||
@@ -116,22 +116,22 @@ from time import strftime,strptime,mktime,time,daylight
|
||||
import os,sys
|
||||
import datetime
|
||||
import iso8601
|
||||
import c2stuff
|
||||
from c2stuff import c2_open
|
||||
from runkeeperstuff import runkeeper_open
|
||||
from sporttracksstuff import sporttracks_open
|
||||
from tpstuff import tp_open
|
||||
import rowers.c2stuff as c2stuff
|
||||
from rowers.c2stuff import c2_open
|
||||
from rowers.runkeeperstuff import runkeeper_open
|
||||
from rowers.sporttracksstuff import sporttracks_open
|
||||
from rowers.tpstuff import tp_open
|
||||
from iso8601 import ParseError
|
||||
import stravastuff
|
||||
from stravastuff import strava_open
|
||||
import polarstuff
|
||||
import sporttracksstuff
|
||||
import underarmourstuff
|
||||
from underarmourstuff import underarmour_open
|
||||
import tpstuff
|
||||
import runkeeperstuff
|
||||
import ownapistuff
|
||||
from ownapistuff import TEST_CLIENT_ID, TEST_CLIENT_SECRET, TEST_REDIRECT_URI
|
||||
import rowers.stravastuff as stravastuff
|
||||
from rowers.stravastuff import strava_open
|
||||
import rowers.polarstuff as polarstuff
|
||||
import rowers.sporttracksstuff as sporttracksstuff
|
||||
import rowers.underarmourstuff as underarmourstuff
|
||||
from rowers.underarmourstuff import underarmour_open
|
||||
import rowers.tpstuff as tpstuff
|
||||
import rowers.runkeeperstuff as runkeeperstuff
|
||||
import rowers.ownapistuff as ownapistuff
|
||||
from rowers.ownapistuff import TEST_CLIENT_ID, TEST_CLIENT_SECRET, TEST_REDIRECT_URI
|
||||
from rowsandall_app.settings import (
|
||||
C2_CLIENT_ID, C2_REDIRECT_URI, C2_CLIENT_SECRET,
|
||||
STRAVA_CLIENT_ID, STRAVA_REDIRECT_URI, STRAVA_CLIENT_SECRET,
|
||||
@@ -181,7 +181,7 @@ from scipy.signal import savgol_filter
|
||||
from django.shortcuts import render_to_response
|
||||
from Cookie import SimpleCookie
|
||||
from shutil import copyfile,move
|
||||
import mytypes
|
||||
import rowers.mytypes as mytypes
|
||||
from rowingdata import rower as rrower
|
||||
from rowingdata import main as rmain
|
||||
from rowingdata import rowingdata as rrdata
|
||||
@@ -200,7 +200,7 @@ import mpld3
|
||||
from mpld3 import plugins
|
||||
import stravalib
|
||||
from stravalib.exc import ActivityUploadFailed,TimeoutExceeded
|
||||
from weather import get_wind_data,get_airport_code,get_metar_data
|
||||
from rowers.weather import get_wind_data,get_airport_code,get_metar_data
|
||||
|
||||
from oauth2_provider.models import Application,Grant,AccessToken
|
||||
|
||||
@@ -228,6 +228,33 @@ class JSONResponse(HttpResponse):
|
||||
kwargs['content_type'] = 'application/json'
|
||||
super(JSONResponse, self).__init__(content, **kwargs)
|
||||
|
||||
def getfavorites(r,row):
|
||||
workouttype = 'ote'
|
||||
if row.workouttype in mytypes.otwtypes:
|
||||
workouttype = 'otw'
|
||||
|
||||
matchworkouttypes = [workouttype,'all']
|
||||
|
||||
workoutsource = row.workoutsource
|
||||
if 'speedcoach2' in row.workoutsource:
|
||||
workoutsource = 'speedcoach2'
|
||||
|
||||
try:
|
||||
favorites = FavoriteChart.objects.filter(user=r,
|
||||
workouttype__in=matchworkouttypes).order_by("id")
|
||||
favorites2 = FavoriteChart.objects.filter(user=r,
|
||||
workouttype__in=[workoutsource]).order_by("id")
|
||||
|
||||
favorites = favorites | favorites2
|
||||
|
||||
|
||||
maxfav = len(favorites)-1
|
||||
except:
|
||||
favorites = None
|
||||
maxfav = 0
|
||||
|
||||
return favorites,maxfav
|
||||
|
||||
|
||||
def getrequestrower(request,rowerid=0,userid=0,notpermanent=False):
|
||||
|
||||
@@ -365,23 +392,23 @@ from rowers.serializers import RowerSerializer,WorkoutSerializer
|
||||
from rest_framework import status,permissions,generics
|
||||
from rest_framework.decorators import api_view, renderer_classes
|
||||
|
||||
from permissions import IsOwnerOrNot
|
||||
from rowers.permissions import IsOwnerOrNot
|
||||
|
||||
import plots
|
||||
import mailprocessing
|
||||
import rowers.plots as plots
|
||||
import rowers.mailprocessing as mailprocessing
|
||||
|
||||
from io import BytesIO
|
||||
from scipy.special import lambertw
|
||||
|
||||
from dataprep import timedeltaconv
|
||||
from dataprep import getsmallrowdata_db
|
||||
from rowers.dataprep import timedeltaconv
|
||||
from rowers.dataprep import getsmallrowdata_db
|
||||
|
||||
from scipy.interpolate import griddata
|
||||
|
||||
#LOCALTIMEZONE = tz('Etc/UTC')
|
||||
USER_LANGUAGE = 'en-US'
|
||||
|
||||
from interactiveplots import *
|
||||
from rowers.interactiveplots import *
|
||||
from rowers.celery import result as celery_result
|
||||
|
||||
# Define the API documentation
|
||||
@@ -852,14 +879,14 @@ def getidfromuri(uri):
|
||||
|
||||
|
||||
|
||||
from utils import (
|
||||
from rowers.utils import (
|
||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||
str2bool,range_to_color_hex,absolute,myqueue,get_call,
|
||||
calculate_age,rankingdistances,rankingdurations,
|
||||
is_ranking_piece,my_dict_from_instance,wavg,NoTokenError
|
||||
)
|
||||
|
||||
import datautils
|
||||
import rowers.datautils as datautils
|
||||
|
||||
from rowers.models import checkworkoutuser,checkaccessuser
|
||||
|
||||
@@ -1142,7 +1169,7 @@ def trydf(df,aantal,column):
|
||||
|
||||
return s
|
||||
|
||||
import teams
|
||||
import rowers.teams as teams
|
||||
from rowers.models import C2WorldClassAgePerformance
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user