Skip to content

Commit

Permalink
Merge pull request #22 from vkurup/add-activity-notes
Browse files Browse the repository at this point in the history
Add support for activity notes (fingers-crossed for Travis)
  • Loading branch information
vkurup authored Dec 15, 2018
2 parents 8790902 + af98df7 commit 2b2acae
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language: python

python:
- "2.7"
- "3.5"
- "3.6"

install:
- pip install tox-travis
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Other contributions from:
* Jason M. (@DaddyTheRunner)
* Adam Neumann (@noizwaves)
* Stephen Doyle (@stevedoyle)
* Loïs Taulelle (@ltaulell)

Thank you!
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGES
=======

v1.0.0, 2018-12-15
------------------

* Add support for Notes field


v0.8.0, 2018-04-27
------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-8, Vinod Kurup
Copyright (c) 2013-9, Vinod Kurup
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Basic usage example::
Compatibility
-------------

* Python 2.7 or 3.5+
* Python 2.7 or 3.7+

License
-------
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '0.8.0'
__version__ = '1.0.0'

setup(
name='python-tcxparser',
Expand All @@ -24,7 +24,7 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries :: Python Modules',
],
install_requires=[
Expand Down
5 changes: 5 additions & 0 deletions tcxparser/tcxparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,8 @@ def cadence_max(self):
"""Returns max cadence of workout"""
cadence_data = self.cadence_values()
return max(cadence_data)

@property
def activity_notes(self):
"""Return contents of Activity/Notes field if it exists."""
return getattr(self.activity, 'Notes', '')
1 change: 1 addition & 0 deletions tests/files/test.tcx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Activities>
<Activity Sport="Running">
<Id>2012-12-26T21:29:53Z</Id>
<Notes>Aerobics</Notes>
<Lap StartTime="2012-12-26T21:29:53Z">
<TotalTimeSeconds>608.47</TotalTimeSeconds>
<DistanceMeters>1609.34399414</DistanceMeters>
Expand Down
3 changes: 3 additions & 0 deletions tests/test_tcxparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def test_ascent_is_correct(self):
def test_descent_is_correct(self):
self.assertAlmostEqual(self.tcx.descent, 166.307128903)

def test_activity_notes_is_correct(self):
self.assertEqual(self.tcx.activity_notes, 'Aerobics')


class BugTest(TestCase):

Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tox]
envlist = py27, py35, flake8, coverage
envlist = py27, py36, flake8, coverage

[travis]
python =
3.5: py35, flake8, coverage
3.6: py36, flake8, coverage
2.7: py27

[testenv:flake8]
Expand Down

0 comments on commit 2b2acae

Please sign in to comment.