Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
tomkah222
Gym-app
Commits
110ab730
Commit
110ab730
authored
5 months ago
by
Nikita Sjölander
Browse files
Options
Download
Email Patches
Plain Diff
Corrected a problem where workouts would be scheduled on the day before. Timezone issue
parent
b2341cc9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
backend/__pycache__/config.cpython-311.pyc
backend/__pycache__/config.cpython-311.pyc
+0
-0
backend/cal_app.py
backend/cal_app.py
+1
-1
calendar/src/calendar.js
calendar/src/calendar.js
+4
-4
No files found.
backend/__pycache__/config.cpython-311.pyc
View file @
110ab730
No preview for this file type
This diff is collapsed.
Click to expand it.
backend/cal_app.py
View file @
110ab730
from
flask
import
Flask
,
Blueprint
,
jsonify
,
request
,
send_from_directory
from
flask_mysqldb
import
MySQL
#
from flask_mysqldb import MySQL
from
flask_sqlalchemy
import
SQLAlchemy
from
sqlalchemy
import
text
from
datetime
import
timedelta
...
...
This diff is collapsed.
Click to expand it.
calendar/src/calendar.js
View file @
110ab730
...
...
@@ -31,14 +31,14 @@ changeCurrentDay = (day) => {
currentDay
:
newDate
,
isModalOpen
:
true
,
},
()
=>
this
.
fetchWorkoutsForDate
(
newDate
.
to
ISOString
().
split
(
'
T
'
)[
0
]
)
()
=>
this
.
fetchWorkoutsForDate
(
newDate
.
to
LocaleDateString
(
'
sv-SE
'
)
)
);
};
componentDidMount
()
{
// Fetch workouts for today on load
const
today
=
new
Date
().
to
ISOString
().
split
(
'
T
'
)[
0
]
;
const
today
=
new
Date
().
to
LocaleDateString
(
'
sv-SE
'
)
;
this
.
fetchWorkoutsForDate
(
today
);
}
...
...
@@ -52,7 +52,7 @@ submitWorkout = async () => {
const
workoutData
=
{
user_id
:
1
,
activity_id
:
1
,
schedule_date
:
currentDay
.
to
ISOString
().
split
(
'
T
'
)[
0
]
,
schedule_date
:
currentDay
.
to
LocaleDateString
(
'
sv-SE
'
)
,
start_time
:
startTime
,
end_time
:
endTime
,
activity_name
:
workout
...
...
@@ -71,7 +71,7 @@ submitWorkout = async () => {
const
result
=
await
response
.
json
();
console
.
log
(
'
Workout saved:
'
,
result
);
this
.
fetchWorkoutsForDate
(
currentDay
.
to
ISOString
().
split
(
'
T
'
)[
0
]
);
this
.
fetchWorkoutsForDate
(
currentDay
.
to
LocaleDateString
(
'
sv-SE
'
)
);
}
catch
(
error
)
{
console
.
error
(
'
Error saving workout:
'
,
error
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment