Exemple #1
0
def runEmailLink(startDate, endDate):
    

    res = ommc.getSurveyAllData(startDate, endDate)
    resObject = res.json()

    mergevars = dex.getMailchimpOtherMergeVars() 
    ''' e.g.: {  'POSTAL': ['zip', 'zipcode', 'postal']  }'''
    
    mailchimpBatch = []

    for survey in resObject: 
        emailIndex = ommc.getEmailQuestionIndex(survey)
        if emailIndex == None:
            continue; 

        mergedict = {}
        for m in mergevars.keys():
            mmIndex = ommc.getQuestionIndexFromStrings(survey, mergevars[m])
            if mmIndex != None: 
                mergedict[mmIndex] = m
        
        
        extracted = ommc.extractFieldsFromResponses(survey, emailIndex, mergedict) 
        mailchimpBatch = mailchimpBatch + extracted

    ommc.subcribeNewUsers( mailchimpBatch )
Exemple #2
0
def printSurveyNameList(): 
    today = datetime.now()

    #no gap, just to get list info
    res = ommc.getSurveyAllData(today, today)
    resObject = res.json()

    for survey in resObject: 
        print '{} {}'.format(survey['Name'], survey['Id'])