API: database update
This commit is contained in:
parent
5f98cfdc4a
commit
f1c24a6edc
@ -38,13 +38,13 @@ def upgrade():
|
|||||||
sa.Column('duration', sa.Interval(), nullable=False),
|
sa.Column('duration', sa.Interval(), nullable=False),
|
||||||
sa.Column('pauses', sa.Interval(), nullable=True),
|
sa.Column('pauses', sa.Interval(), nullable=True),
|
||||||
sa.Column('moving', sa.Interval(), nullable=True),
|
sa.Column('moving', sa.Interval(), nullable=True),
|
||||||
sa.Column('distance', sa.Numeric(precision=5, scale=3), nullable=True),
|
sa.Column('distance', sa.Numeric(precision=6, scale=3), nullable=True),
|
||||||
sa.Column('min_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('min_alt', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('max_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('max_alt', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('descent', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('descent', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('ascent', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('ascent', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('max_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('max_speed', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('ave_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('ave_speed', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['sport_id'], ['sports.id'], ),
|
sa.ForeignKeyConstraint(['sport_id'], ['sports.id'], ),
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
@ -24,13 +24,13 @@ def upgrade():
|
|||||||
sa.Column('duration', sa.Interval(), nullable=False),
|
sa.Column('duration', sa.Interval(), nullable=False),
|
||||||
sa.Column('pauses', sa.Interval(), nullable=True),
|
sa.Column('pauses', sa.Interval(), nullable=True),
|
||||||
sa.Column('moving', sa.Interval(), nullable=True),
|
sa.Column('moving', sa.Interval(), nullable=True),
|
||||||
sa.Column('distance', sa.Numeric(precision=5, scale=3), nullable=True),
|
sa.Column('distance', sa.Numeric(precision=6, scale=3), nullable=True),
|
||||||
sa.Column('min_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('min_alt', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('max_alt', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('max_alt', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('descent', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('descent', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('ascent', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('ascent', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('max_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('max_speed', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.Column('ave_speed', sa.Numeric(precision=5, scale=2), nullable=True),
|
sa.Column('ave_speed', sa.Numeric(precision=6, scale=2), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
sa.ForeignKeyConstraint(['activity_id'], ['activities.id'], ),
|
||||||
sa.PrimaryKeyConstraint('activity_id', 'segment_id')
|
sa.PrimaryKeyConstraint('activity_id', 'segment_id')
|
||||||
)
|
)
|
||||||
|
@ -125,13 +125,13 @@ class Activity(db.Model):
|
|||||||
duration = db.Column(db.Interval, nullable=False)
|
duration = db.Column(db.Interval, nullable=False)
|
||||||
pauses = db.Column(db.Interval, nullable=True)
|
pauses = db.Column(db.Interval, nullable=True)
|
||||||
moving = db.Column(db.Interval, nullable=True)
|
moving = db.Column(db.Interval, nullable=True)
|
||||||
distance = db.Column(db.Numeric(5, 3), nullable=True) # kilometers
|
distance = db.Column(db.Numeric(6, 3), nullable=True) # kilometers
|
||||||
min_alt = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
min_alt = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
max_alt = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
max_alt = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
descent = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
descent = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
ascent = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
ascent = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
max_speed = db.Column(db.Numeric(5, 2), nullable=True) # km/h
|
max_speed = db.Column(db.Numeric(6, 2), nullable=True) # km/h
|
||||||
ave_speed = db.Column(db.Numeric(5, 2), nullable=True) # km/h
|
ave_speed = db.Column(db.Numeric(6, 2), nullable=True) # km/h
|
||||||
bounds = db.Column(postgresql.ARRAY(db.Float), nullable=True)
|
bounds = db.Column(postgresql.ARRAY(db.Float), nullable=True)
|
||||||
segments = db.relationship('ActivitySegment',
|
segments = db.relationship('ActivitySegment',
|
||||||
lazy=True,
|
lazy=True,
|
||||||
@ -261,13 +261,13 @@ class ActivitySegment(db.Model):
|
|||||||
duration = db.Column(db.Interval, nullable=False)
|
duration = db.Column(db.Interval, nullable=False)
|
||||||
pauses = db.Column(db.Interval, nullable=True)
|
pauses = db.Column(db.Interval, nullable=True)
|
||||||
moving = db.Column(db.Interval, nullable=True)
|
moving = db.Column(db.Interval, nullable=True)
|
||||||
distance = db.Column(db.Numeric(5, 3), nullable=True) # kilometers
|
distance = db.Column(db.Numeric(6, 3), nullable=True) # kilometers
|
||||||
min_alt = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
min_alt = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
max_alt = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
max_alt = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
descent = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
descent = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
ascent = db.Column(db.Numeric(5, 2), nullable=True) # meters
|
ascent = db.Column(db.Numeric(6, 2), nullable=True) # meters
|
||||||
max_speed = db.Column(db.Numeric(5, 2), nullable=True) # km/h
|
max_speed = db.Column(db.Numeric(6, 2), nullable=True) # km/h
|
||||||
ave_speed = db.Column(db.Numeric(5, 2), nullable=True) # km/h
|
ave_speed = db.Column(db.Numeric(6, 2), nullable=True) # km/h
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '<Segment \'{}\' for activity \'{}\'>'.format(
|
return '<Segment \'{}\' for activity \'{}\'>'.format(
|
||||||
|
@ -27,8 +27,8 @@ export default class ActivityAddEdit extends React.Component {
|
|||||||
<div>
|
<div>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title>mpwo - {activity
|
<title>mpwo - {activity
|
||||||
? 'Edit an activity'
|
? 'Edit a workout'
|
||||||
: 'Add an activity'}
|
: 'Add a workout'}
|
||||||
</title>
|
</title>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
<br /><br />
|
<br /><br />
|
||||||
@ -41,7 +41,7 @@ export default class ActivityAddEdit extends React.Component {
|
|||||||
<div className="col-md-8">
|
<div className="col-md-8">
|
||||||
<div className="card add-activity">
|
<div className="card add-activity">
|
||||||
<h2 className="card-header text-center">
|
<h2 className="card-header text-center">
|
||||||
{activity ? 'Edit an activity' : 'Add an activity'}
|
{activity ? 'Edit a workout' : 'Add a workout'}
|
||||||
</h2>
|
</h2>
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
{activity ? (
|
{activity ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user