mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-14 06:15:26 -05:00
Bug fixes/v0.5.1 (#545)
* dump deps * add job for new groups on interval * change sort icon * fix cart icon * bump version * changelog * early return if no comments * remove comment Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -6,7 +6,7 @@ from typing import Any, Optional, Union
|
||||
import dotenv
|
||||
from pydantic import BaseSettings, Field, PostgresDsn, validator
|
||||
|
||||
APP_VERSION = "v0.5.0"
|
||||
APP_VERSION = "v0.5.1"
|
||||
DB_VERSION = "v0.5.0"
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
|
||||
@@ -89,6 +89,9 @@ class ImportDatabase:
|
||||
def import_comments(self):
|
||||
comment_dir: Path = self.import_dir.joinpath("comments", "comments.json")
|
||||
|
||||
if not comment_dir.exists():
|
||||
return
|
||||
|
||||
comments = ImportDatabase.read_models_file(file_path=comment_dir, model=CommentOut)
|
||||
|
||||
for comment in comments:
|
||||
@@ -192,7 +195,7 @@ class ImportDatabase:
|
||||
|
||||
return import_notifications
|
||||
|
||||
def import_settings(self): # ! Broken
|
||||
def import_settings(self):
|
||||
settings_file = self.import_dir.joinpath("settings", "settings.json")
|
||||
settings = ImportDatabase.read_models_file(settings_file, SiteSettings)
|
||||
settings = settings[0]
|
||||
@@ -367,7 +370,6 @@ def import_database(
|
||||
theme_report = import_session.import_themes()
|
||||
|
||||
if import_pages:
|
||||
print("IMport Pages")
|
||||
page_report = import_session.import_pages()
|
||||
|
||||
group_report = []
|
||||
@@ -378,6 +380,7 @@ def import_database(
|
||||
if import_users:
|
||||
user_report = import_session.import_users()
|
||||
|
||||
notification_report = []
|
||||
if import_notifications:
|
||||
notification_report = import_session.import_notifications()
|
||||
|
||||
|
||||
@@ -45,6 +45,12 @@ def update_webhook_schedule():
|
||||
time = cron_parser(group.webhook_time)
|
||||
job = JOB_STORE.get(group.name)
|
||||
|
||||
if not job:
|
||||
logger.error(f"No job found for group: {group.name}")
|
||||
logger.info(f"Creating scheduled task for {group.name}")
|
||||
JOB_STORE.update(add_group_to_schedule(scheduler, group))
|
||||
continue
|
||||
|
||||
scheduler.reschedule_job(
|
||||
job.scheduled_task.id,
|
||||
trigger="cron",
|
||||
@@ -77,24 +83,26 @@ class ScheduledFunction:
|
||||
)
|
||||
|
||||
|
||||
def add_group_to_schedule(scheduler, group: GroupInDB):
|
||||
cron = cron_parser(group.webhook_time)
|
||||
|
||||
return {
|
||||
group.name: ScheduledFunction(
|
||||
scheduler,
|
||||
post_webhooks,
|
||||
cron=cron,
|
||||
name=group.name,
|
||||
args=[group.id],
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def init_webhook_schedule(scheduler, job_store: dict):
|
||||
session = create_session()
|
||||
all_groups: list[GroupInDB] = db.groups.get_all(session)
|
||||
|
||||
for group in all_groups:
|
||||
cron = cron_parser(group.webhook_time)
|
||||
|
||||
job_store.update(
|
||||
{
|
||||
group.name: ScheduledFunction(
|
||||
scheduler,
|
||||
post_webhooks,
|
||||
cron=cron,
|
||||
name=group.name,
|
||||
args=[group.id],
|
||||
)
|
||||
}
|
||||
)
|
||||
job_store.update(add_group_to_schedule(scheduler, group))
|
||||
|
||||
session.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user