def print_email_conversion(cur, timeStart, timeEnd, variant): (emailsSent, percentOpened, percentClicked, percentCreated, percentLoggedIn) = calculate_email_conversion(cur, timeStart, timeEnd, variant) #and print them out: print(\ """ Total: %s Opened: %.1f Clicked: %.1f Created: %.1f Logged In: %.1f """ % (emailsSent, percentOpened, percentClicked, percentCreated, percentLoggedIn))
def get_conversion_summary(cur, variant): """@returns: string (a summary of the conversion numbers over the past week)""" curTime = list(time.localtime()) #print the headers table = _make_row(10, "Day|Sent|Open|Click|Create|Login") #for each day of the week in the past: for day in range(1, 8): startTime = copy.copy(curTime) startTime[2] = startTime[2] - day startTime = time.strftime("%Y-%m-%d 00:00:00", time.struct_time(startTime)) endTime = copy.copy(curTime) endTime[2] = endTime[2] - (day-1) endTime = time.strftime("%Y-%m-%d 00:00:00", time.struct_time(endTime)) (emailsSent, percentOpened, percentClicked, percentCreated, percentLoggedIn) = calculate_email_conversion(cur, startTime, endTime, variant) table += _make_row(10, "%s|%s|%.1f|%.1f|%.1f|%.1f" % (day, emailsSent, percentOpened, percentClicked, percentCreated, percentLoggedIn)) return table
def get_conversion_summary(cur, variant): """@returns: string (a summary of the conversion numbers over the past week)""" curTime = list(time.localtime()) #print the headers table = _make_row(10, "Day|Sent|Open|Click|Create|Login") #for each day of the week in the past: for day in range(1, 8): startTime = copy.copy(curTime) startTime[2] = startTime[2] - day startTime = time.strftime("%Y-%m-%d 00:00:00", time.struct_time(startTime)) endTime = copy.copy(curTime) endTime[2] = endTime[2] - (day - 1) endTime = time.strftime("%Y-%m-%d 00:00:00", time.struct_time(endTime)) (emailsSent, percentOpened, percentClicked, percentCreated, percentLoggedIn) = calculate_email_conversion(cur, startTime, endTime, variant) table += _make_row( 10, "%s|%s|%.1f|%.1f|%.1f|%.1f" % (day, emailsSent, percentOpened, percentClicked, percentCreated, percentLoggedIn)) return table