SPS' V3 templates. Updated Harri's templates too to update the workato endpoints.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
with open('./sample_payload.json', 'r') as file:
|
||||
@ -6,16 +5,49 @@ with open('./sample_payload.json', 'r') as file:
|
||||
|
||||
def main(input):
|
||||
# input = input['input']
|
||||
quiz_name = ""
|
||||
quiz_score = ""
|
||||
sso_uid = ""
|
||||
course = ""
|
||||
timestamp = input['payload']['data']['attributes']['created_at']
|
||||
for items in input['payload']['data']['included']:
|
||||
if items['type'] == 'quizzes':
|
||||
try:
|
||||
if items['name'] == 'Deutsch Einstufungstest':
|
||||
print('quiz!')
|
||||
except TypeError as h:
|
||||
print(h)
|
||||
|
||||
if items['attributes']['name'] == 'Deutsch Einstufungstest':
|
||||
quiz_score = input['attributes']['value']
|
||||
quiz_name = items['attributes']['name']
|
||||
print(quiz_score, quiz_name)
|
||||
elif items['type'] == 'people':
|
||||
print('people')
|
||||
sso_uid = items['attributes']['sso_uid']
|
||||
elif items['type'] == 'courses':
|
||||
course = items['attributes']['name']
|
||||
|
||||
if input['payload']['data']['type'] == 'quiz_completed_events':
|
||||
job_report = { "email": sso_uid, "course": course, "quiz_name": quiz_name, "quiz_score": quiz_score, "timestamp": timestamp }
|
||||
print(job_report)
|
||||
if quiz_name:
|
||||
if quiz_name == "Deutsch Einstufungstest":
|
||||
"""
|
||||
At this point, we need to add a new row to the Google Sheet
|
||||
The columns to add are:
|
||||
email = sso_uid
|
||||
course name = course
|
||||
date stamp = created at
|
||||
quiz name = quiz name
|
||||
quiz score = quiz score
|
||||
"""
|
||||
print("adding row!")
|
||||
else:
|
||||
"""
|
||||
At this point, we need to add a new row to the Google Sheet
|
||||
The columns to add are:
|
||||
email = sso_uid
|
||||
course name = course
|
||||
date stamp = created at
|
||||
link to BE profile = "=HYPERLINK(SUBSTITUTE("https://ops-live.zenjob.tools/ops/employee/showByUuid/{{sso_uid}}}";"test";INDIRECT("R[0]C1"; FALSE));"Talent Profil")"
|
||||
Tag = "=IFS(INDIRECT("R[0]C2"; FALSE)="Kassentraining";"food_cashier_lms, exp_cashier_123";INDIRECT("R[0]C2"; FALSE)="Servicetraining";"pool_service_lms, exp_service_staff_123";INDIRECT("R[0]C2"; FALSE)="";"")"
|
||||
tag assigned = false
|
||||
"""
|
||||
print("final else statement")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(input)
|
||||
|
||||
Reference in New Issue
Block a user