Changeset 1183d5a in OpenWorkouts-current


Ignore:
Timestamp:
Jan 31, 2019, 3:25:08 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current, feature/docs, master
Children:
3357e47
Parents:
ed7e9d7 (diff), dbfab70 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged patches from darcs

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • README.txt

    red7e9d7 r1183d5a  
    22============
    33
    4 Getting Started
    5 ---------------
    6 
    7 - Change directory into your newly created project.
    8 
    9     cd ow
    10 
    11 - Create a Python virtual environment.
    12 
    13     python3 -m venv env
    14 
    15 - Upgrade packaging tools.
    16 
    17     env/bin/pip install --upgrade pip setuptools
    18 
    19 - Install the project in editable mode with its testing requirements.
    20 
    21     env/bin/pip install -e ".[testing]"
    22 
    23 - Run your project's tests.
    24 
    25     env/bin/pytest
    26 
    27 - Run your project.
    28 
    29     env/bin/pserve development.ini
     4TBW, if you look for installation instructions, take a look at the script
     5bin/install
  • bin/install

    red7e9d7 r1183d5a  
    5858install_openworkouts() {
    5959    . ${env_path}/bin/activate
    60     yes | pip install --upgrade --process-dependency-links -e ${current}[testing]
     60    yes | pip install --upgrade -e ${current}[testing]
    6161    deactivate
    6262}
  • ow/static/js/ow.js

    red7e9d7 r1183d5a  
    335335                        select_x_axis_label(d).attr('style', "font-weight: regular;");
    336336                    }
     337                })
     338                .on('click', function(d) {
     339                    window.location.href = d.url;
    337340                });
    338341
  • ow/templates/profile.pt

    red7e9d7 r1183d5a  
    5959      </div>
    6060
    61       <div class="profile-bio" tal:content="getattr(context, 'bio', '')">
    62       </div>
     61      <div class="profile-bio" tal:content="getattr(context, 'bio', '')"></div>
    6362
    64       <div class="workouts">
     63      <div class="profile-workouts">
    6564        <tal:t i18n:translate="">Total number of workouts</tal:t>:
    6665        <tal:w tal:replace="context.num_workouts"></tal:w>
    67       </div>
    68 
    69       <div class="latest-workouts">
    70         <p i18n:translate="">Latest workouts</p>
    71         <tal:r tal:repeat="workout context.workouts()[:5]">
    72           <div class="workout">
    73             <tal:c tal:content="workout.sport"></tal:c> -
    74             <a href="" tal:content="workout.title"
    75                tal:attributes="href request.resource_url(workout)"></a>
    76             (<tal:c tal:content="workout.start"></tal:c>,
    77             <tal:c tal:content="workout.duration"></tal:c>,
    78             <tal:c tal:content="workout.rounded_distance"></tal:c> km)
    79           </div>
    80         </tal:r>
    8166      </div>
    8267
     
    8974        </div>
    9075      </div>
     76
     77
     78      <tal:r tal:repeat="workout workouts">
     79
     80        <a name="workouts"></a>
     81
     82
     83        <article class="workout-resume">
     84
     85          <h2 class="workout-title">
     86            <a href="" tal:content="workout.title"
     87               tal:attributes="href request.resource_url(workout)"></a>
     88          </h2>
     89
     90          <ul class="workout-info">
     91            <li>
     92              <tal:c tal:content="workout.start_in_timezone(context.timezone)"></tal:c>
     93            </li>
     94            <li>
     95              <!--! use the properly formatted duration instead of the timedelta object -->
     96              <tal:c tal:content="workout._duration"></tal:c>
     97            </li>
     98            <li tal:condition="workout.distance">
     99              <tal:c tal:content="workout.rounded_distance"></tal:c> km
     100            </li>
     101          </ul>
     102
     103          <ul class="workout-info" tal:define="hr workout.hr; cad workout.cad">
     104            <li tal:condition="hr">
     105              <span i18n:translate="">HR (bpm)</span>:
     106              <tal:c tal:content="hr['min']"></tal:c>
     107              <tal:t i18n:translate="">Min.</tal:t>,
     108              <tal:c tal:content="hr['avg']"></tal:c>
     109              <tal:t i18n:translate="">Avg.</tal:t>,
     110              <tal:c tal:content="hr['max']"></tal:c>
     111              <tal:t i18n:translate="">Max.</tal:t>
     112            </li>
     113            <li tal:condition="cad">
     114              <span i18n:translate="">Cad</span>:
     115              <tal:c tal:content="cad['min']"></tal:c>
     116              <tal:t i18n:translate="">Min.</tal:t>,
     117              <tal:c tal:content="cad['avg']"></tal:c>
     118              <tal:t i18n:translate="">Avg.</tal:t>,
     119              <tal:c tal:content="cad['max']"></tal:c>
     120              <tal:t i18n:translate="">Max.</tal:t>
     121            </li>
     122          </ul>
     123
     124          <div class="workout-intro" tal:content="workout.notes"></div>
     125
     126          <div class="workout-map" tal:condition="workout.has_gpx">
     127            <a href="" tal:attributes="href request.resource_url(workout)">
     128              <img src="" tal:attributes="src request.static_url(workout.map_screenshot);
     129                        alt workout.title; title workout.title">
     130            </a>
     131          </div>
     132
     133        </article>
     134
     135      </tal:r>
    91136
    92137    </div>
  • ow/tests/views/test_user.py

    red7e9d7 r1183d5a  
    267267        """
    268268        request = dummy_request
     269        # profile page for the current day (no workouts avalable)
    269270        response = user_views.profile(john, request)
    270         assert len(response.keys()) == 1
     271        assert len(response.keys()) == 2
    271272        current_month = datetime.now(timezone.utc).strftime('%Y-%m')
    272273        assert response['current_month'] == current_month
     274        assert response['workouts'] == []
     275        # profile page for a previous date, that has workouts
     276        request.GET['year'] = 2015
     277        request.GET['month'] = 8
     278        response = user_views.profile(john, request)
     279        assert len(response.keys()) == 2
     280        assert response['current_month'] == '2015-08'
     281        assert response['workouts'] == john.workouts(2015, 8)
    273282
    274283    def test_login_get(self, dummy_request):
  • ow/views/user.py

    red7e9d7 r1183d5a  
    166166    """
    167167    now = datetime.now(timezone.utc)
    168     return {
    169         'current_month': now.strftime('%Y-%m')
     168    year = int(request.GET.get('year', now.year))
     169    month = int(request.GET.get('month', now.month))
     170    return {
     171        'workouts': context.workouts(year, month),
     172        'current_month': '{year}-{month}'.format(
     173            year=str(year), month=str(month).zfill(2))
    170174    }
    171175
     
    280284            'distance': int(round(stats[month]['distance'])),
    281285            'elevation': int(stats[month]['elevation']),
    282             'workouts': stats[month]['workouts']
     286            'workouts': stats[month]['workouts'],
     287            'url': request.resource_url(
     288                context, 'profile',
     289                query={'year': str(month[0]), 'month': str(month[1])},
     290                anchor='workouts')
    283291        }
    284292        json_stats.append(month_stats)
  • setup.py

    red7e9d7 r1183d5a  
    2121    'waitress',
    2222    'repoze.folder',
    23     'repoze.catalog==0.8.4',
     23    'repoze.catalog @ git+https://github.com/WuShell/repoze.catalog.git@0.8.4'
     24    '#egg=repoze.catalog-0.8.4',
    2425    'bcrypt',
    2526    'FormEncode',
     
    3940    'pytest-xdist',
    4041    'pytest-codestyle',
    41 ]
    42 
    43 dependency_links = [
    44     'git+https://github.com/WuShell/repoze.catalog.git@0.8.4'
    45     '#egg=repoze.catalog-0.8.4'
    4642]
    4743
     
    6460    include_package_data=True,
    6561    zip_safe=False,
    66     dependency_links=dependency_links,
    6762    extras_require={
    6863        'testing': tests_require,
Note: See TracChangeset for help on using the changeset viewer.