jovandeginste / workout-tracker

A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities
Other
945 stars 31 forks source link

Timezone #61

Closed gitjax closed 5 months ago

gitjax commented 5 months ago

Great project!

When I try to set the timezone by clicking my username on top and then selecting timezone and clicking "update profile" I am not sure it "sticks". Next time I go to that same page, "Timezone" is empty. (Same goes for language after I have selected it).

I notice my workout (I only have one so far) is off in time - most likely due to the timezone not being set.

Maybe I am doing something wrong .... ?

jovandeginste commented 5 months ago

Could you verify whether you are using the latest release?

gitjax commented 5 months ago

I followed the instructions and installed ghcr.io/jovandeginste/workout-tracker:master. At the bottom of the webinterface I have "Workout Tracker, branch master (179acb77)". Should I be using a different tag?

jovandeginste commented 5 months ago

That was the version I was testing with. Maybe something with new users not properly saving a profile..

gitjax commented 5 months ago

Is that something that is saved in the filesystem? The only thing mounted into the container from the host is a directory - /data .. where all I find is "database.db". Is that what is expected?

gitjax commented 5 months ago

When I click "update profile" and tail the log at the same time I notice:

cbaf8f9273d588a","module":"webserver","request":{"time":"2024-04-08T11:21:27.606237054Z","method":"POST","host":"REDACTED","path":"/user/profile","query":"","params":{},"route":"/user/profile","ip":"REDACTED","referer":"https://REDACTED/user/profile","length":82},"response":{"time":"2024-04-08T11:21:27.845501233Z","latency":239264296,"status":302,"length":0}}

...that 302 probably has something to do with this?

jovandeginste commented 5 months ago

The profile is saved in the database, so that is expected. The 302 is normal, because a save (update) is a "post" which then redirects to the profile view (a get). You could open the database with sqlite and check what's in the profiles table:

sqlite3 database.db 'select * from profiles;'
gitjax commented 5 months ago

Then I get:

1|2024-04-06 15:07:37.76620996+00:00|2024-04-06 15:07:37.76620996+00:00||0|0|en|running|Europe/Amsterdam|
2|2024-04-06 15:08:53.838483602+00:00|2024-04-06 15:08:53.838483602+00:00||0|0|browser|running|Europe/Brussels|
3|2024-04-06 15:09:25.659210822+00:00|2024-04-06 15:09:25.659210822+00:00||0|0|en|running|Europe/Amsterdam|
4|2024-04-08 11:21:27.641886755+00:00|2024-04-08 11:21:27.641886755+00:00||0|0|en|running|Europe/Amsterdam|
jovandeginste commented 5 months ago

And when you filter for your user:

sqlite3 database.db "select * from profiles where user_id = (select id from  users where username='YOUR USERNAME');"
gitjax commented 5 months ago

right, that gives me no output at all. Right after installing - if I recall correctly - I just changed the username of "admin" (which I believe was there by default) to "jax." If I now do

sqlite3 database.db "select * from profiles where user_id = (select id from users where username='jax');"

...I get nothing... Should I try creating a new user?

jovandeginste commented 5 months ago

Please try that; I will however see what causes the issue.

gitjax commented 5 months ago

:-) incidentally, I cannot find a "create user" on the "Manage users" page ... so not sure how to go about creating another user.

I've never poked at sqlite-files before but I managed to figure out that there is a "users" table, where my user "jax" seems to be defined.

gitjax commented 5 months ago

For what it's worth I had

WT_REGISTRATION_DISABLED=true

..I tried changing it to false but same behaviour. .. cannot "save" profile settings for my user.

gitjax commented 5 months ago

Aha! ...So I set REGISTRATION_DISABLED to false, then:

...and now, as that new user, I could save settings under user profile. So it works if I dont user the original "admin" account

jovandeginste commented 5 months ago

It may be an issue when the admin user is auto-created - no associated profile exists for that user and thus changes are dropped...