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