API & Client: minor database change
This commit is contained in:
parent
74dcdc6840
commit
67099e5665
@ -35,13 +35,13 @@ def upgrade():
|
||||
sa.Column('duration', sa.Interval(), nullable=False),
|
||||
sa.Column('pauses', sa.Interval(), nullable=True),
|
||||
sa.Column('moving', sa.Interval(), nullable=True),
|
||||
sa.Column('distance', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('distance', sa.Numeric(precision=5, scale=3), nullable=True),
|
||||
sa.Column('min_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('max_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('descent', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('ascent', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('max_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('ave_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
||||
sa.Column('max_speed', sa.Numeric(precision=5, scale=3), nullable=True),
|
||||
sa.Column('ave_speed', sa.Numeric(precision=5, scale=3), nullable=True),
|
||||
sa.ForeignKeyConstraint(['sport_id'], ['sports.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
|
@ -48,13 +48,13 @@ class Activity(db.Model):
|
||||
duration = db.Column(db.Interval, nullable=False)
|
||||
pauses = db.Column(db.Interval, nullable=True)
|
||||
moving = db.Column(db.Interval, nullable=True)
|
||||
distance = db.Column(db.Numeric(5, 2), nullable=True) # kilometers
|
||||
distance = db.Column(db.Numeric(5, 3), nullable=True) # kilometers
|
||||
min_alt = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
||||
max_alt = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
||||
descent = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
||||
ascent = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
||||
max_speed = db.Column(db.Numeric(5, 2), nullable=True) # km/h
|
||||
ave_speed = db.Column(db.Numeric(5, 2), nullable=True) # km/h
|
||||
max_speed = db.Column(db.Numeric(5, 3), nullable=True) # km/h
|
||||
ave_speed = db.Column(db.Numeric(5, 3), nullable=True) # km/h
|
||||
|
||||
def __str__(self):
|
||||
return str(self.sports.label) + \
|
||||
|
@ -42,11 +42,11 @@ def test_add_an_activity_gpx(app):
|
||||
assert 1 == data['data']['activities'][0]['sport_id']
|
||||
assert '0:04:10' == data['data']['activities'][0]['duration']
|
||||
assert data['data']['activities'][0]['ascent'] == 0.4
|
||||
assert data['data']['activities'][0]['ave_speed'] == 4.6
|
||||
assert data['data']['activities'][0]['ave_speed'] == 4.602
|
||||
assert data['data']['activities'][0]['descent'] == 23.4
|
||||
assert data['data']['activities'][0]['distance'] == 0.32
|
||||
assert data['data']['activities'][0]['max_alt'] == 998.0
|
||||
assert data['data']['activities'][0]['max_speed'] == 5.09
|
||||
assert data['data']['activities'][0]['max_speed'] == 5.086
|
||||
assert data['data']['activities'][0]['min_alt'] == 975.0
|
||||
assert data['data']['activities'][0]['moving'] == '0:04:10'
|
||||
assert data['data']['activities'][0]['pauses'] is None
|
||||
@ -99,11 +99,11 @@ def test_get_an_activity_with_gpx(app):
|
||||
assert 1 == data['data']['activities'][0]['sport_id']
|
||||
assert '0:04:10' == data['data']['activities'][0]['duration']
|
||||
assert data['data']['activities'][0]['ascent'] == 0.4
|
||||
assert data['data']['activities'][0]['ave_speed'] == 4.6
|
||||
assert data['data']['activities'][0]['ave_speed'] == 4.602
|
||||
assert data['data']['activities'][0]['descent'] == 23.4
|
||||
assert data['data']['activities'][0]['distance'] == 0.32
|
||||
assert data['data']['activities'][0]['max_alt'] == 998.0
|
||||
assert data['data']['activities'][0]['max_speed'] == 5.09
|
||||
assert data['data']['activities'][0]['max_speed'] == 5.086
|
||||
assert data['data']['activities'][0]['min_alt'] == 975.0
|
||||
assert data['data']['activities'][0]['moving'] == '0:04:10'
|
||||
assert data['data']['activities'][0]['pauses'] is None
|
||||
|
@ -58,11 +58,11 @@ def test_edit_an_activity_with_gpx(app):
|
||||
assert 2 == data['data']['activities'][0]['sport_id']
|
||||
assert '0:04:10' == data['data']['activities'][0]['duration']
|
||||
assert data['data']['activities'][0]['ascent'] == 0.4
|
||||
assert data['data']['activities'][0]['ave_speed'] == 4.6
|
||||
assert data['data']['activities'][0]['ave_speed'] == 4.602
|
||||
assert data['data']['activities'][0]['descent'] == 23.4
|
||||
assert data['data']['activities'][0]['distance'] == 0.32
|
||||
assert data['data']['activities'][0]['max_alt'] == 998.0
|
||||
assert data['data']['activities'][0]['max_speed'] == 5.09
|
||||
assert data['data']['activities'][0]['max_speed'] == 5.086
|
||||
assert data['data']['activities'][0]['min_alt'] == 975.0
|
||||
assert data['data']['activities'][0]['moving'] == '0:04:10'
|
||||
assert data['data']['activities'][0]['pauses'] is None
|
||||
@ -263,13 +263,13 @@ def test_edit_an_activity_wo_gpx_partial(app):
|
||||
assert data['data']['activities'][0]['sport_id'] == 1
|
||||
assert data['data']['activities'][0]['duration'] == '0:17:04'
|
||||
assert data['data']['activities'][0]['ascent'] is None
|
||||
assert data['data']['activities'][0]['ave_speed'] == 35.16
|
||||
assert data['data']['activities'][0]['ave_speed'] == 35.156
|
||||
assert data['data']['activities'][0]['descent'] is None
|
||||
assert data['data']['activities'][0]['distance'] == 10.0
|
||||
assert data['data']['activities'][0]['max_alt'] is None
|
||||
assert data['data']['activities'][0]['max_speed'] == 35.16
|
||||
assert data['data']['activities'][0]['max_speed'] == 35.156
|
||||
assert data['data']['activities'][0]['min_alt'] is None
|
||||
assert data['data']['activities'][0]['moving'] is None # no calculate
|
||||
assert data['data']['activities'][0]['moving'] is None # no calculated
|
||||
assert data['data']['activities'][0]['pauses'] is None
|
||||
assert data['data']['activities'][0]['with_gpx'] is False
|
||||
|
||||
|
@ -85,6 +85,7 @@ function FormWithoutGpx (props) {
|
||||
className="form-control input-lg"
|
||||
min={0}
|
||||
required
|
||||
step="0.001"
|
||||
type="number"
|
||||
/>
|
||||
</label>
|
||||
|
Loading…
Reference in New Issue
Block a user