Subversion Repositories SmartDukaan

Rev

Rev 18958 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18958 Rev 18961
Line 31... Line 31...
31
 
31
 
32
def main():
32
def main():
33
    logging.debug('Starting SMS Blaster Process.....'+str(datetime.now()))
33
    logging.debug('Starting SMS Blaster Process.....'+str(datetime.now()))
34
    timeCondition = datetime.now()-timedelta(hours=2)
34
    timeCondition = datetime.now()-timedelta(hours=2)
35
    expireTimeCondition = datetime.now()+timedelta(hours=2)
35
    expireTimeCondition = datetime.now()+timedelta(hours=2)
36
    eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.sendsms==True).filter(or_(notification_campaigns.smsprocessed==False, notification_campaigns.smsprocessed is None)).filter(notification_campaigns.created<timeCondition).filter(notification_campaigns.expiresat>expireTimeCondition).all()
36
    eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.sendsms==True).filter(or_(notification_campaigns.smsprocessed==False, notification_campaigns.smsprocessed==None)).filter(notification_campaigns.created<timeCondition).filter(notification_campaigns.expiresat>expireTimeCondition).all()
37
    #eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.id==5417).all()
37
    #eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.id==5417).all()
38
    
38
    
39
    for notificationCampaign in eligibleSmsNotficationCampaigns:
39
    for notificationCampaign in eligibleSmsNotficationCampaigns:
40
        logging.debug('Notification_Campign_Id:- '+str(notificationCampaign.id))
40
        logging.debug('Notification_Campign_Id:- '+str(notificationCampaign.id))
41
        notificationCampaign.smsprocessed = True
41
        notificationCampaign.smsprocessed = True