From 478b21c8ef8e7c9e147733d94997864a6c529daa Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Thu, 30 Mar 2023 21:18:23 -0400 Subject: [PATCH] Finished Walmart script. Agriwebb notes. --- .../Talkspace_1099/dashboard.html.liquid | 11 +++- CustomerNotes/Agriwebb.md | 33 ++++++++++ Scripts/API_Tests/get_courses.py | 65 ++++++++++--------- 3 files changed, 75 insertions(+), 34 deletions(-) diff --git a/Custom_Templates/customer_templates/Talkspace_1099/dashboard.html.liquid b/Custom_Templates/customer_templates/Talkspace_1099/dashboard.html.liquid index c2fbc143..58d5b42c 100644 --- a/Custom_Templates/customer_templates/Talkspace_1099/dashboard.html.liquid +++ b/Custom_Templates/customer_templates/Talkspace_1099/dashboard.html.liquid @@ -7,13 +7,18 @@
-

TALKSPACE FOUNTAIN LOGO

- {% assign persongroup = current_person.groups.last.name | split: "-" %} -

Hi {{current_person.first_name}}! 👋 {{ persongroup | slice: 1 }}

+

TALKSPACE FOUNTAIN LOGO

+ {% if current_person.groups.size > 0 %} + {% assign persongroup = current_person.groups.last.name | split: "-" %} + {% endif %} +

Hi {{current_person.first_name}}! 👋 {% if current_person.groups.size > 0 %} {{ persongroup | slice: 1 }} {% endif %}

Please complete all your 2023 Compliance Courses.

+
+ +
diff --git a/CustomerNotes/Agriwebb.md b/CustomerNotes/Agriwebb.md index d8153810..d1cb94fd 100644 --- a/CustomerNotes/Agriwebb.md +++ b/CustomerNotes/Agriwebb.md @@ -20,3 +20,36 @@ Properties for promotions. Who has or hasn't completed a prior promotion? This would be for new customers - how can they create promotions for existing customers? Existing customers are a phase 2 thing. They want track in Chargbee. + +## 03/30/2023 + +### Languages with David + +ASK: + +- Trial account to their software for branding purposes +- Branding/Style guide PDF +- Languages +- Badges (done?) +- Leah? +- Instance Division Segmentation + +Languages: partnership with a reseller in Brazil. They will be selling Agriwebb in their region. +Cargill team is the partner. +14th April +Marketing & product is being converted/translated +Support materials is on that list. But hasn't been started. +All hosted in Intercom + +90% of academy content are videos. but they haven't been translated yet. +Everything embedded from Wistia. +Audio is unchanging, still English +Will be used for internal and external training with Cargill +Since app is in english, they will need to re-shoot videos after app translation +Captions are acceptable for now. + +In the future: + +- Design refresh +- Content refresh with product updates +- Leveraging API for enrolling ppl in courses based on Agriwebb product dashboard. diff --git a/Scripts/API_Tests/get_courses.py b/Scripts/API_Tests/get_courses.py index cc47c68e..f787e78d 100644 --- a/Scripts/API_Tests/get_courses.py +++ b/Scripts/API_Tests/get_courses.py @@ -2,11 +2,12 @@ import requests import pandas as pd import Apikeys +apiKey = Apikeys.walmartprod +course_dict = {} + def get_course(): count = 0 - apiKey = Apikeys.walmartprod courses = [] - course_dict = {} while True: count += 1 @@ -31,40 +32,42 @@ def get_course(): # FIX: After this, something is being overwritten. cat_id = response["relationships"]["categories"]["data"] - cats = [] - - # Pseudo-code - if len(cat_id) == 0: - pass - elif len(cat_id) == 1: - get_cat_name(cat_id) - course_dict(update({"categories": cat})) - else: - for item in cat_id: - # make api call - # return the name - update the dictionary - - for item in cat_id: - cats = [] - categoryid = item["id"] - # TODO: Maybe split the api call to a separate function? - url = f"https://api2.northpass.com/v2/categories/{categoryid}" - headers = {"accept": "application/json", "X-Api-Key": apiKey} - cat_resp = requests.get(url, headers=headers) - cat_data = cat_resp.json() - cat_name = cat_data["data"]["attributes"]["name"] - cats.append(cat_name) - course_dict.update({"categories": cats}) - courses.append(course_dict) + get_cat_name(cat_id, course_dict, courses) if "next" not in nextlink: break - write_to_csv(courses) +def get_cat_name(cat_id, course_dict, courses): + headers = {"accept": "application/json", "X-Api-Key": apiKey} + cats = [] + if len(cat_id) == 0: + pass + elif len(cat_id) == 1: + categoryid = cat_id[0]["id"] + url = f"https://api2.northpass.com/v2/categories/{categoryid}" + cat_resp = requests.get(url, headers=headers) + cat_data = cat_resp.json() + cat_name = cat_data["data"]["attributes"]["name"] + print(cat_name) + cats.append(cat_name) + course_dict.update({"categories": cats}) + else: + for item in cat_id: + categoryid = item["id"] + url = f"https://api2.northpass.com/v2/categories/{categoryid}" + cat_resp = requests.get(url, headers=headers) + cat_data = cat_resp.json() + cat_name = cat_data["data"]["attributes"]["name"] + cats.append(cat_name) + course_dict.update({"categories": cats}) -def get_cat_name(item): - pass + + try: + courses.append(course_dict) + except TypeError as e: + print(f"Error: {e}") + finally: + write_to_csv(courses) def write_to_csv(courses):