import urllib import config import quapi import parsers import helpers import filemanager from datetime import datetime, timedelta import numpy as np import pandas as pd config.init() survey = helpers.chooseSurvey() quapi.sendSurvey(config.seedemail, survey) users = [] x = filemanager.User() x.state = 's' x.sendTime = datetime.now() x.selectTime = datetime.now() x.email = config.seedemail x.survey = survey users.append(x) filemanager.writecsv(filemanager.usersToArray(users),config.filename)
dists[i] = dists[i] + helpers.calcDist(listofListOfParents[i],listofListOfParents[j]) running = 0 for i in range(0,len(users)): if users[i].state == 's' or users[i].state == 'c' or users[i].state == 'q': running = running +1 #set Ns to Qs until either credits, total coupons are exceeded. while credits > 0 and running < config.total: index = dists.index(max(dists)) if users[index].state == 'n': users[index].state = 'q' users[index].selectTime = datetime.now() credits = credits-1 running = running + 1 if running == config.total: print('ran out of coupons at ' + str(datetime.now())) exit() dists[index] = 0 found = 0 for i in range(0,len(users)): if users[i].state == 'n': found = 1 if not found: credits = 0 #write to csv filemanager.writecsv(filemanager.usersToArray(users), csvpath) validation[0][0] = 'GOOD' filemanager.writecsv(validation,valpath)