From fa62212739f74f45c09ec865fa61e02aa00ae435 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 25 Mar 2024 08:09:43 +0100 Subject: [PATCH] removing redundant code --- rowers/interactiveplots.py | 78 --------------------------- rowers/templates/goldmedalscores.html | 9 +--- 2 files changed, 1 insertion(+), 86 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 9b436a6d..8555400e 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1686,84 +1686,6 @@ def goldmedalscorechart(user, startdate=None, enddate=None): script, div = get_chart("/markerworkouts", chart_data) return script, div, outids - TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair' - source = ColumnDataSource( - data=dict( - markerscore=df['markerscore'], - score=df['score'], - markerduration=df['markerduration'].apply( - lambda x: totaltime_sec_to_string(x, shorten=True)), - duration=df['duration'].apply( - lambda x: totaltime_sec_to_string(x, shorten=True)), - date=df['date'], - fdate=df['date'].map(lambda x: x.strftime('%d-%m-%Y')), - url=df['url'], - workout=df['workout'] - ) - ) - - plot = figure(tools=TOOLS, x_axis_type='datetime', - width=900, height=600, - toolbar_location='above', - toolbar_sticky=False) - - # add watermark - watermarkurl = "/static/img/logo7.png" - watermarkrange = Range1d(start=0, end=1) - watermarkalpha = 0.6 - watermarkx = 0.99 - watermarky = 0.01 - watermarkw = 184 - watermarkh = 35 - watermarkanchor = 'bottom_right' - plot.extra_y_ranges = {"watermark": watermarkrange} - plot.extra_x_ranges = {"watermark": watermarkrange} - - plot.image_url([watermarkurl], watermarkx, watermarky, - watermarkw, watermarkh, - global_alpha=watermarkalpha, - w_units='screen', - h_units='screen', - anchor=watermarkanchor, - dilate=True, - x_range_name="watermark", - y_range_name="watermark", - ) - - plot.xaxis.axis_label = 'Date' - plot.yaxis.axis_label = 'Gold Medal Score' - - plot.circle('date', 'score', source=source, fill_color='blue', - size=10, - legend_label='Workouts') - - plot.circle('date', 'markerscore', source=source, fill_color='red', - size=10, - legend_label='Marker Workouts') - - plot.legend.location = "bottom_left" - - plot.x_range = Range1d( - startdate, enddate+datetime.timedelta(days=5), - ) - - hover = plot.select(dict(type=HoverTool)) - - hover.tooltips = OrderedDict([ - ('Marker', '@markerscore{int}'), - ('Test', '@markerduration'), - ('Score', '@score{int}'), - ('Duration', '@duration'), - ('Date', '@fdate'), - ('Workout', '@workout') - ]) - - taptool = plot.select(type=TapTool) - taptool.callback = OpenURL(url='@url') - - script, div = components(plot) - - return script, div, outids def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=7, diff --git a/rowers/templates/goldmedalscores.html b/rowers/templates/goldmedalscores.html index e623a746..b0cb042c 100644 --- a/rowers/templates/goldmedalscores.html +++ b/rowers/templates/goldmedalscores.html @@ -60,14 +60,6 @@ {% block main %} - - - - - - {% if rower.user %}

Gold Medal Scores for {{ rower.user.first_name }}

{% else %} @@ -76,6 +68,7 @@
    +
  • Hover over the workout to see details, click on the workout to open in a separate page.