donish
This commit is contained in:
parent
2a1fc80600
commit
f763b87446
50
sync.py
50
sync.py
|
@ -110,15 +110,59 @@ def write_hubspot_csv():
|
||||||
filewriter.writerow([email,ownerId,licenseName,status,flipbooks,limit,exceed, totalFlipbookVisitors, lastSyncDate, lastSeen])
|
filewriter.writerow([email,ownerId,licenseName,status,flipbooks,limit,exceed, totalFlipbookVisitors, lastSyncDate, lastSeen])
|
||||||
|
|
||||||
|
|
||||||
|
### write intercom
|
||||||
|
def write_intercom():
|
||||||
|
with open("newestIntercomSyncro.csv", "w") as csvfile:
|
||||||
|
|
||||||
|
filewriter = csv.writer(csvfile, delimiter=";",quotechar="|",quoting=csv.QUOTE_MINIMAL)
|
||||||
|
filewriter.writerow([
|
||||||
|
'email',
|
||||||
|
'lastWebVisit'
|
||||||
|
'LicenseName',
|
||||||
|
'LicenseStatus',
|
||||||
|
'HubSpotOwner'
|
||||||
|
'FlipBooksUsed',
|
||||||
|
'FlipbookLimit',
|
||||||
|
'FlipbookAvailable',
|
||||||
|
'LastSyncDate'
|
||||||
|
])
|
||||||
|
|
||||||
|
intercomUsers = list(IntercomUsers.items())[0][1]
|
||||||
|
|
||||||
|
for key, value in iPaperUsers.items():
|
||||||
|
for i in value:
|
||||||
|
|
||||||
|
email = i["email"]
|
||||||
|
ownerId=getOwnerIdForeignKey(hubSpotUsers, email)
|
||||||
|
|
||||||
|
licenseName = i['LicenseName']
|
||||||
|
|
||||||
|
# not gonna get around to this, but the idea is to get the foreign id in hubspot users, and then get the matching consultant name in hubspotowners
|
||||||
|
HubSpotOwner = '...'
|
||||||
|
|
||||||
|
status = i['Status']
|
||||||
|
used = i['Flipbooks']
|
||||||
|
limit = i['FlipbookLimit']
|
||||||
|
available = limit - used
|
||||||
|
lastWebVisit = getLastWebVisit(intercomUsers, email)
|
||||||
|
|
||||||
|
lastSyncDate = getLastSyncDate(oldSyncData, email)
|
||||||
|
|
||||||
|
#lastWebVisit
|
||||||
|
|
||||||
|
filewriter.writerow([email,licenseName,HubSpotOwner,status, used, limit, available, lastSyncDate, lastWebVisit])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getLastSyncDate(users, email):
|
def getLastSyncDate(users, email):
|
||||||
for v in users:
|
for v in users:
|
||||||
print('somthinw')
|
|
||||||
if v['Email'] == email:
|
if v['Email'] == email:
|
||||||
if not v['LastSync']:
|
if not v['LastSync']:
|
||||||
print('hello')
|
|
||||||
return datetime.date.today().strftime("%d-%m-%Y %H:%M:%S")
|
return datetime.date.today().strftime("%d-%m-%Y %H:%M:%S")
|
||||||
else:
|
else:
|
||||||
print('nay')
|
|
||||||
return v['LastSync']
|
return v['LastSync']
|
||||||
|
|
||||||
def getLastSeen (users, email, date):
|
def getLastSeen (users, email, date):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user