Activities: minor changes

This commit is contained in:
Sam 2018-05-02 20:47:42 +02:00
parent 37ed5405bb
commit 979833bd07
2 changed files with 42 additions and 41 deletions

View File

@ -67,11 +67,9 @@ class Activity(db.Model):
"creation_date": self.creation_date, "creation_date": self.creation_date,
"modification_date": self.modification_date, "modification_date": self.modification_date,
"activity_date": self.activity_date, "activity_date": self.activity_date,
"duration": (self.duration.total_seconds() "duration": str(self.duration) if self.duration else None,
if self.duration "pauses": str(self.pauses) if self.pauses else None,
else None), "moving": str(self.moving) if self.moving else None,
"pauses": self.pauses.total_seconds() if self.pauses else None,
"moving": self.moving.total_seconds() if self.moving else None,
"distance": float(self.distance) if self.distance else None, "distance": float(self.distance) if self.distance else None,
"min_alt": float(self.min_alt) if self.min_alt else None, "min_alt": float(self.min_alt) if self.min_alt else None,
"max_alt": float(self.max_alt) if self.max_alt else None, "max_alt": float(self.max_alt) if self.max_alt else None,

View File

@ -27,7 +27,7 @@ class ActivityDisplay extends React.Component {
<div className="container"> <div className="container">
{activity && sports.length > 0 && ( {activity && sports.length > 0 && (
<div className="row"> <div className="row">
<div className="col-md-12"> <div className="col-md-6">
<div className="card"> <div className="card">
<div className="card-header"> <div className="card-header">
{sports.filter(sport => sport.id === activity.sport_id) {sports.filter(sport => sport.id === activity.sport_id)
@ -35,41 +35,44 @@ class ActivityDisplay extends React.Component {
{activity.activity_date} {activity.activity_date}
</div> </div>
<div className="card-body"> <div className="card-body">
<div className="row"> <p>
<div className="col-md-8"> <i className="fa fa-calendar" aria-hidden="true" />{' '}
<p> Start at {activity.activity_date}
<i className="fa fa-calendar" aria-hidden="true" />{' '} </p>
Start at {activity.activity_date} <p>
</p> <i className="fa fa-clock-o" aria-hidden="true" />{' '}
<p> Duration: {activity.duration} {' '}
<i className="fa fa-clock-o" aria-hidden="true" />{' '} {activity.pauses !== '0:00:00' && (
Duration: {activity.duration} {' '} `(pauses: ${activity.pauses})`
{activity.pauses > 0 && ( )}
`(pauses: ${activity.pauses})` </p>
)} <p>
</p> <i className="fa fa-road" aria-hidden="true" />{' '}
<p> Distance: {activity.distance} km</p>
<i className="fa fa-road" aria-hidden="true" />{' '} <p>
Distance: {activity.distance}km</p> <i className="fa fa-tachometer" aria-hidden="true" />
<p> {' '}
<i className="fa fa-tachometer" aria-hidden="true" /> Average speed: {activity.ave_speed} km/h -{' '}
{' '} Max speed : {activity.max_speed} km/h
Average speed: {activity.ave_speed} km/h -{' '} </p>
Max speed : {activity.max_speed} km/h <p><i className="fi-mountains" />{' '}
</p> Min altitude: {activity.min_alt}m -{' '}
<p><i className="fi-mountains" />{' '} Max altitude: {activity.max_alt}m
Min altitude: {activity.min_alt}m -{' '} </p>
Max altitude: {activity.max_alt}m <p><i className="fa fa-location-arrow" />{' '}
</p> Ascent: {activity.ascent}m -{' '}
<p><i className="fa fa-location-arrow" />{' '} Descent: {activity.descent}m
Ascent: {activity.ascent}m -{' '} </p>
Descent: {activity.descent}m </div>
</p> </div>
</div> </div>
<div className="col-md-4"> <div className="col-md-6">
Map <div className="card">
</div> <div className="card-header">
</div> Map
</div>
<div className="card-body">
to do
</div> </div>
</div> </div>
</div> </div>