BO 1.25 App Texts
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
from ..mautic import MauticHelper
|
||||
from django_cron import CronJobBase, Schedule
|
||||
|
||||
|
||||
class MyCronJob(CronJobBase):
|
||||
RUN_EVERY_MINS = 60 # every 2 hours
|
||||
|
||||
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
|
||||
code = 'aitrainer_backoffice.controlling.cron' # a unique code
|
||||
|
||||
def do(self):
|
||||
sync_customers() # do your thing here
|
||||
|
||||
|
||||
def sync_customers():
|
||||
helper = MauticHelper()
|
||||
helper.sync()
|
||||
helper.syncTrial()
|
||||
@@ -1,12 +1,17 @@
|
||||
import requests
|
||||
import logging
|
||||
from django.db import connections
|
||||
import datetime
|
||||
|
||||
from ..models.customer import Customer
|
||||
|
||||
|
||||
class MauticHelper:
|
||||
|
||||
def syncTrial(self):
|
||||
tenDays = datetime.datetime - datetime.timedelta(days=10)
|
||||
qs = Customer.objects.raw(
|
||||
'SELECT * from customer WHERE trial_date < "' + tenDays + '" and trial_date is not null')
|
||||
|
||||
def sync(self):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
Reference in New Issue
Block a user