Subversion Repositories SmartDukaan

Rev

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

Rev 17400 Rev 17452
Line 26... Line 26...
26
DataService.initialize(db_hostname="192.168.158.89")
26
DataService.initialize(db_hostname="192.168.158.89")
27
 
27
 
28
logging.basicConfig(level=logging.DEBUG)
28
logging.basicConfig(level=logging.DEBUG)
29
 
29
 
30
def main():
30
def main():
31
    logging.debug('Starting SMS Blaster Process.....'+str(datetime.datetime.now()))
31
    logging.debug('Starting SMS Blaster Process.....'+str(datetime.now()))
32
    timeCondition = datetime.now()-timedelta(hours=2)
32
    timeCondition = datetime.now()-timedelta(hours=2)
33
    expireTimeCondition = datetime.now()+timedelta(hours=2)
33
    expireTimeCondition = datetime.now()+timedelta(hours=2)
34
    eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.sendsms==True).filter(notification_campaigns.smsprocessed==False).filter(notification_campaigns.created<timeCondition).filter(notification_campaigns.expiresat>expireTimeCondition).all()
34
    eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.sendsms==True).filter(notification_campaigns.smsprocessed==False).filter(notification_campaigns.created<timeCondition).filter(notification_campaigns.expiresat>expireTimeCondition).all()
35
    #eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.id==5417).all()
35
    #eligibleSmsNotficationCampaigns = notification_campaigns.query.filter(notification_campaigns.id==5417).all()
36
    
36
    
Line 180... Line 180...
180
        logging.debug('Total Sms Sent:- '+str(len(sentSmsUsers)))
180
        logging.debug('Total Sms Sent:- '+str(len(sentSmsUsers)))
181
        
181
        
182
        notificationCampaign.smsprocessed = True
182
        notificationCampaign.smsprocessed = True
183
        session.commit()
183
        session.commit()
184
        
184
        
185
    logging.debug('SMS Blaster Process Completed.....'+str(datetime.datetime.now()))
185
    logging.debug('SMS Blaster Process Completed.....'+str(datetime.now()))
186
                  
186
                  
187
 
187
 
188
if __name__=='__main__':
188
if __name__=='__main__':
189
    main()
189
    main()
190
    try:
190
    try: