diff --git a/Custom_Templates/customer_templates/Walmart Luminate Prod/_cards_course.html.liquid b/Custom_Templates/customer_templates/Walmart Luminate Prod/_cards_course.html.liquid index 2bd8026a..20fa9914 100644 --- a/Custom_Templates/customer_templates/Walmart Luminate Prod/_cards_course.html.liquid +++ b/Custom_Templates/customer_templates/Walmart Luminate Prod/_cards_course.html.liquid @@ -28,21 +28,27 @@
{{course.properties.course_length}}
{% endif %} - + {% else %}
{% endif %} - + diff --git a/Custom_Templates/customer_templates/Walmart Luminate Prod/_course_progress_and_cta.html.liquid b/Custom_Templates/customer_templates/Walmart Luminate Prod/_course_progress_and_cta.html.liquid index 1c3db9fa..230af85c 100644 --- a/Custom_Templates/customer_templates/Walmart Luminate Prod/_course_progress_and_cta.html.liquid +++ b/Custom_Templates/customer_templates/Walmart Luminate Prod/_course_progress_and_cta.html.liquid @@ -9,6 +9,23 @@ + {% if course.enrolled? == false and course.properties.course_cost != 0 %} +
+ $ {{ course.properties.course_cost }} +
+ +
+ + + + +{% else %} +
@@ -32,7 +49,7 @@ href="{% route course_enrollment, code: course.enrollment_code %}" {% endif %} > - {% if course.enrolled? == false %} + {% if course.enrolled? == false %} {% t shared.enroll %} {% elsif course.started? == false %} {% t shared.course.start, key: current_school.course_vocabulary %} @@ -42,5 +59,73 @@ {% t shared.continue %} {% endif %} + {% endif %} {% endif %} +{% comment %} +
+
+
+ +
+ {% endcomment %} + + + + diff --git a/Scripts/API_Tests/; b/Scripts/API_Tests/; new file mode 100644 index 00000000..f4b5c7cc --- /dev/null +++ b/Scripts/API_Tests/; @@ -0,0 +1,99 @@ +import requests +import pandas as pd +import Apikeys +import pprint + +pp = pprint.PrettyPrinter(indent=4) +apiKey = Apikeys.SKUID +course_dict = {} + +COURSES= [ +"Shopping an order", +"Delivery FAQs", +"Checking out Shopping & Delivery orders", +"Shopping & Delivery FAQs", +"Communicating with customers", +"Delivering an order", +] + +def get_course(): + count = 0 + courses = [] + + while True: + count += 1 + url = f"https://api.northpass.com/v2/courses?page={count}" + headers = {"accept": "application/json", "X-Api-Key": apiKey} + response = requests.get(url, headers=headers) + data = response.json() + nextlink = data["links"] + + for response in data["data"]: + status = response["attributes"]["status"] + uuid = response["id"] + name = response["attributes"]["name"] + # build_url = response["links"]["builder"]["href"] + # if name in COURSES: + print(uuid) + course_dict = { + "id": uuid, + "name": name, + "status": status, + # "build_url": build_url + # "url": f"https://walmart.northpass.com/app/courses/{uuid}", + } + courses.append(course_dict) + # print(courses) + + # FIX: Up until here, each course gets read to the terminal. + # FIX: After this, something is being overwritten. + + # cat_id = response["relationships"]["categories"]["data"] + # get_cat_name(cat_id, course_dict, courses) + + if "next" not in nextlink: + break + + # write_to_csv(courses) + # pp.pprint(courses) + # print(len(courses)) + +def get_cat_name(course_dict): + 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://api.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://api.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}) + + try: + courses.append(course_dict) + except TypeError as e: + print(f"Error: {e}") + finally: + write_to_csv(courses) + + +def write_to_csv(courses): + df = pd.DataFrame.from_dict(courses) + df.to_csv("/Users/normrasmussen/Downloads/sps_courses.csv") + + +if __name__ == "__main__": + get_course() diff --git a/Scripts/API_Tests/get_courses_and_categories.py b/Scripts/API_Tests/get_courses_and_categories.py index 64f201bd..7d70001a 100644 --- a/Scripts/API_Tests/get_courses_and_categories.py +++ b/Scripts/API_Tests/get_courses_and_categories.py @@ -4,7 +4,7 @@ import Apikeys import pprint pp = pprint.PrettyPrinter(indent=4) -apiKey = Apikeys.SPS +apiKey = Apikeys.SKUID course_dict = {} COURSES= [ @@ -48,13 +48,13 @@ def get_course(): # FIX: Up until here, each course gets read to the terminal. # FIX: After this, something is being overwritten. - # cat_id = response["relationships"]["categories"]["data"] - # get_cat_name(cat_id, course_dict, courses) + cat_id = response["relationships"]["categories"]["data"] + get_cat_name(cat_id, course_dict, courses) if "next" not in nextlink: break - write_to_csv(courses) + # write_to_csv(courses) # pp.pprint(courses) # print(len(courses)) @@ -68,10 +68,14 @@ def get_cat_name(cat_id, course_dict, courses): url = f"https://api.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}) + try: + cat_name = cat_data["data"]["attributes"]["name"] + cats.append(cat_name) + course_dict.update({"categories": cats}) + except KeyError: + print(f"key error for cat {cat_id}") + finally: + pass else: for item in cat_id: categoryid = item["id"] diff --git a/Todos.md b/Todos.md index 8aa38933..7f0b9db7 100644 --- a/Todos.md +++ b/Todos.md @@ -351,3 +351,8 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th ## 06-24-2024 - [ ] Anthology - URL Cut over to `academy.anthology.com` + +## 06-26-2024 + +- [ ] Walmart - Add visuals to instructions for single activity +- [ ] Walmart - Change accordion in video activities to new accordion.