Subversion Repositories SmartDukaan

Rev

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

Rev 15444 Rev 15455
Line 118... Line 118...
118
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY );
118
select timestampdiff(second, callhistory.last_fetch_time, created) from callhistory where last_fetch_time is not null and call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY );
119
"""
119
"""
120
FRESH_QUERY_AIT="""
120
FRESH_QUERY_AIT="""
121
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY);
121
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY);
122
"""
122
"""
-
 
123
#select count(*) from retailerlinks where date(activated) is not null and date(activated)=date(now() - interval 1 day);
123
FRESH_QUERY_LINKS_CONVERTED="""
124
FRESH_QUERY_LINKS_CONVERTED="""
124
select count(*) from retailerlinks where date(activated) is not null and date(activated)=date(now() - interval 1 day);
125
select count(*) from users u join retailerlinks rl on (rl.code =upper( u.referrer) or rl.code=u.utm_campaign) where date(rl.activated)=date(now()- interval 1 day);
125
"""
126
"""
126
FRESH_QUERY_LINKS_NOT_CONVERTED="""
127
FRESH_QUERY_LINKS_NOT_CONVERTED="""
127
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 1 day);
128
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 1 day);
128
"""
129
"""
129
FRESH_AGENTS_CALLED_COUNT="""
130
FRESH_AGENTS_CALLED_COUNT="""
Line 145... Line 146...
145
"""
146
"""
146
AGENT_FRESH_QUERY_AIT="""
147
AGENT_FRESH_QUERY_AIT="""
147
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
148
select timestampdiff(second, last_action_time, created) from fetchdatahistory where call_type='fresh' and date(created)=date(now() - INTERVAL 1 DAY) and agent_id=%s;
148
"""
149
"""
149
AGENT_FRESH_QUERY_LINKS_CONVERTED="""
150
AGENT_FRESH_QUERY_LINKS_CONVERTED="""
150
select count(*) from retailerlinks where date(activated) is not null and date(activated)=date(now() - interval 1 day) and agent_id=%s;
151
select count(*) from users u join retailerlinks rl on (rl.code =upper( u.referrer) or rl.code=u.utm_campaign) where date(rl.activated)=date(now()- interval 1 day) and agent_id=%s;
151
"""
152
"""
152
AGENT_FRESH_QUERY_LINKS_NOT_CONVERTED="""
153
AGENT_FRESH_QUERY_LINKS_NOT_CONVERTED="""
153
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 1 day) and agent_id=%s;
154
select count(*) from retailerlinks where date(activated) is null and date(created)=date(now() - interval 1 day) and agent_id=%s;
154
"""
155
"""
155
 
156
 
Line 1200... Line 1201...
1200
    generateAgentWiseFreshCallingReport()
1201
    generateAgentWiseFreshCallingReport()
1201
    generateFollowUpCallingReport()
1202
    generateFollowUpCallingReport()
1202
    generateAgentWiseFollowupCallingReport()
1203
    generateAgentWiseFollowupCallingReport()
1203
    generateOnBoardingCallingReport()
1204
    generateOnBoardingCallingReport()
1204
    generateAgentWiseOnboardingCallingReport()
1205
    generateAgentWiseOnboardingCallingReport()
1205
    sendmail(["manas.kapoor@shop2020.in","amit.sirohi@shop2020.in","rajneesh.arora@saholic.com"], "", TMP_FILE, SUBJECT)
1206
    #sendmail(["manas.kapoor@shop2020.in","amit.sirohi@shop2020.in","rajneesh.arora@saholic.com"], "", TMP_FILE, SUBJECT)
-
 
1207
    sendmail(["manas.kapoor@shop2020.in"], "", TMP_FILE, SUBJECT)
1206
         
1208
         
1207
def sendmail(email, message, fileName, title):
1209
def sendmail(email, message, fileName, title):
1208
    if email == "":
1210
    if email == "":
1209
        return
1211
        return
1210
    mailServer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
1212
    mailServer = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
Line 1226... Line 1228...
1226
    fileMsg.set_payload(file(TMP_FILE).read())
1228
    fileMsg.set_payload(file(TMP_FILE).read())
1227
    encoders.encode_base64(fileMsg)
1229
    encoders.encode_base64(fileMsg)
1228
    fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
1230
    fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
1229
    msg.attach(fileMsg)
1231
    msg.attach(fileMsg)
1230
    
1232
    
1231
    MAILTO = ['manas.kapoor@saholic.com','amit.sirohi@shop2020.in','rajneesh.arora@saholic.com']
1233
    #MAILTO = ['manas.kapoor@saholic.com','amit.sirohi@shop2020.in','rajneesh.arora@saholic.com']
1232
    #MAILTO = ['manas.kapoor@saholic.com']
1234
    MAILTO = ['manas.kapoor@saholic.com']
1233
    mailServer.login(SENDER, PASSWORD)
1235
    mailServer.login(SENDER, PASSWORD)
1234
    mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
1236
    mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
1235
 
1237
 
1236
if __name__ == '__main__':
1238
if __name__ == '__main__':
1237
    main()
1239
    main()