implement user preference for elevation plots starting at zero;
add docker make command to downgrade db; add (google-powered) translations for the new labels
This commit is contained in:
@ -869,6 +869,7 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
4,
|
||||
6
|
||||
],
|
||||
"start_elevation_at_zero": true,
|
||||
"timezone": "Europe/Paris",
|
||||
"total_distance": 67.895,
|
||||
"total_duration": "6:50:27",
|
||||
@ -883,9 +884,9 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
:<json boolean display_ascent: display highest ascent records and total
|
||||
:<json boolean imperial_units: display distance in imperial units
|
||||
:<json string language: language preferences
|
||||
:<json boolean start_elevation_at_zero: should elevation plots start at zero by default?
|
||||
:<json string timezone: user time zone
|
||||
:<json boolean weekm: does week start on Monday?
|
||||
:<json boolean weekm: does week start on Monday?
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
@ -906,6 +907,7 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
'display_ascent',
|
||||
'imperial_units',
|
||||
'language',
|
||||
'start_elevation_at_zero',
|
||||
'timezone',
|
||||
'weekm',
|
||||
}
|
||||
@ -916,6 +918,7 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
display_ascent = post_data.get('display_ascent')
|
||||
imperial_units = post_data.get('imperial_units')
|
||||
language = get_language(post_data.get('language'))
|
||||
start_elevation_at_zero = post_data.get('start_elevation_at_zero')
|
||||
timezone = post_data.get('timezone')
|
||||
weekm = post_data.get('weekm')
|
||||
|
||||
@ -924,6 +927,7 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
auth_user.display_ascent = display_ascent
|
||||
auth_user.imperial_units = imperial_units
|
||||
auth_user.language = language
|
||||
auth_user.start_elevation_at_zero = start_elevation_at_zero
|
||||
auth_user.timezone = timezone
|
||||
auth_user.weekm = weekm
|
||||
db.session.commit()
|
||||
|
@ -59,6 +59,7 @@ class User(BaseModel):
|
||||
confirmation_token = db.Column(db.String(255), nullable=True)
|
||||
display_ascent = db.Column(db.Boolean, default=True, nullable=False)
|
||||
accepted_policy_date = db.Column(db.DateTime, nullable=True)
|
||||
start_elevation_at_zero = db.Column(db.Boolean, default=True, nullable=False)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'<User {self.username!r}>'
|
||||
@ -211,6 +212,7 @@ class User(BaseModel):
|
||||
'display_ascent': self.display_ascent,
|
||||
'imperial_units': self.imperial_units,
|
||||
'language': self.language,
|
||||
'start_elevation_at_zero': self.start_elevation_at_zero,
|
||||
'timezone': self.timezone,
|
||||
'weekm': self.weekm,
|
||||
},
|
||||
|
Reference in New Issue
Block a user