BO 1.30.15 double Notification class name
This commit is contained in:
parent
b1b1eec56b
commit
1a2ab5ddb8
@ -17,6 +17,7 @@ DEBUG = True
|
||||
|
||||
env = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
|
||||
FIREBASE_APP = initialize_app()
|
||||
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'aitrainer_backoffice',
|
||||
|
@ -17,7 +17,7 @@ else:
|
||||
from aitrainer_backoffice.models.sports import Sport
|
||||
from aitrainer_backoffice.models.customer import Customer
|
||||
|
||||
from ..automation.notification import Notification
|
||||
from ..automation.notification import NotificationExec
|
||||
|
||||
class SportFilter(SimpleListFilter, ABC):
|
||||
title = "Sport"
|
||||
@ -37,7 +37,7 @@ class SportFilter(SimpleListFilter, ABC):
|
||||
|
||||
|
||||
class CustomerAdmin(admin.ModelAdmin):
|
||||
notif = Notification()
|
||||
notif = NotificationExec()
|
||||
|
||||
change_list_template = "controlling/mautic.html"
|
||||
list_display = ('customer_id', 'name','firstname', 'email', 'date_add', 'get_sport')
|
||||
|
@ -12,7 +12,7 @@ else:
|
||||
from .fcm import FCM
|
||||
import traceback
|
||||
|
||||
class Notification:
|
||||
class NotificationExec:
|
||||
fcm = None
|
||||
def __init__(self) -> None:
|
||||
if self.fcm == None:
|
||||
@ -21,7 +21,7 @@ class Notification:
|
||||
def run(self):
|
||||
print("** Running Notification automation")
|
||||
notification_queryset = Notification.objects.using('live').raw('SELECT * from notification WHERE active = 1')
|
||||
|
||||
|
||||
for notification in notification_queryset:
|
||||
if notification.schedule_date != None:
|
||||
pass
|
||||
@ -57,4 +57,4 @@ class Notification:
|
||||
history.notification_date = datetime.datetime.now(tz=cet)
|
||||
history.save()
|
||||
print(f'-- Notification History "{history}" has been saved')
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
from ..automation.notification import Notification
|
||||
from ..automation.notification import NotificationExec
|
||||
from django_cron import CronJobBase, Schedule
|
||||
import datetime
|
||||
|
||||
@ -14,7 +14,7 @@ class MyCronJob(CronJobBase):
|
||||
|
||||
|
||||
class NotificationJob(CronJobBase):
|
||||
notif = Notification()
|
||||
notif = NotificationExec()
|
||||
RUN_EVERY_MINS = 5
|
||||
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
|
||||
code = 'aitrainer_backoffice.controlling.notification' # a unique code
|
||||
|
@ -1 +0,0 @@
|
||||
*/5 * * * * python /aitrainer_backoffice/aitrainer_backoffice/manage.py runcrons > /var/log/cronjob.log
|
Loading…
Reference in New Issue
Block a user