Compare commits
No commits in common. "5251a80d02af954c624f8f4288291c57e4d04b6c" and "ff670abc1dbfab3963fcf5ddd133f64bf2c22687" have entirely different histories.
5251a80d02
...
ff670abc1d
16
app.py
16
app.py
@ -780,7 +780,8 @@ def password_change():
|
||||
current_user.update()
|
||||
|
||||
# Back to profile
|
||||
return render_template("profile.html",
|
||||
return render_template(
|
||||
"profile.html",
|
||||
name=current_user.name,
|
||||
email=current_user.email,
|
||||
profile_image_url=current_user.profile_image,
|
||||
@ -830,7 +831,7 @@ def save_profile_image(image_file):
|
||||
# Save the modified frames as a new GIF
|
||||
output_gif_path = os.path.join(app.config['UPLOAD_FOLDER'], filename.replace(".jpg", ".gif"))
|
||||
processed_frames[0].save(output_gif_path, save_all=True, append_images=processed_frames[1:], loop=0)
|
||||
return output_gif_path
|
||||
current_user.profile_image = output_gif_path
|
||||
else:
|
||||
# Process single image
|
||||
processed_image = process_frame(image, size=(256, 256))
|
||||
@ -839,7 +840,10 @@ def save_profile_image(image_file):
|
||||
# Save the processed image
|
||||
image_path = os.path.join(app.config['UPLOAD_FOLDER'], filename.replace(".gif", ".jpg"))
|
||||
processed_image.save(image_path, 'JPEG', quality=100)
|
||||
return image_path
|
||||
current_user.profile_image = image_path
|
||||
|
||||
# Update user profile
|
||||
current_user.update()
|
||||
|
||||
@app.route('/upload', methods=['POST'])
|
||||
@login_required
|
||||
@ -848,11 +852,7 @@ def upload_profile_image():
|
||||
return 'No file part'
|
||||
|
||||
file = request.files['file']
|
||||
image_path = save_profile_image(file)
|
||||
|
||||
# Update the User
|
||||
current_user.profile_image = image_path
|
||||
current_user.update()
|
||||
save_profile_image(file)
|
||||
|
||||
# Back to profile
|
||||
return redirect(url_for('profile'))
|
||||
|
||||
@ -77,18 +77,18 @@ class User(UserMixin):
|
||||
# Returns all heatmap-values from the last 28 days
|
||||
def get_heatmap(self) -> tuple:
|
||||
# get current day of week as integer. monday is 0 and sunday is 6
|
||||
weekday = 6 - datetime.today().weekday()
|
||||
weekday = datetime.today().weekday()
|
||||
heatmap = [100]
|
||||
|
||||
# append the heatmap values of the current week
|
||||
for day in range(0, weekday):
|
||||
for day in range(0, 6-weekday):
|
||||
heatmap.append(0)
|
||||
|
||||
for day in range (0, 28-weekday):
|
||||
for day in range (0, 28-(6-weekday)):
|
||||
value = get_heatmap_value(self.id, day)
|
||||
heatmap.append(value)
|
||||
heatmap.reverse()
|
||||
day = 27-weekday
|
||||
day = 27-(6-weekday)
|
||||
return heatmap, day
|
||||
|
||||
def accept_List(self, HabitList_id):
|
||||
|
||||
@ -50,6 +50,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
||||
validateForm()
|
||||
.then(isValid => {
|
||||
if (isValid) {
|
||||
console.log("Validated 2");
|
||||
editForm.submit();
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user