Got groups and courses for Walmart Supplier. Updated the carousel and recommended for Chubb - haven't pushed to prod yet.

This commit is contained in:
Norm Rasmussen
2025-02-28 17:13:02 -05:00
parent 46efc9a422
commit 73282a0dac
7 changed files with 93 additions and 55 deletions

View File

@ -1,3 +1,16 @@
{% if current_person.groups.any? %}
{% for group in current_person.groups %}
{% if group.id == '' %}
{% comment %}
< ----------------------------->
The carousel HTML goes here.
< ----------------------------->
{% endcomment %}
{% endif %}
{% endfor %}
{% endif %}
{% if current_person.groups.any? %} {% if current_person.groups.any? %}
{% for group in current_person.groups %} {% for group in current_person.groups %}
{% if group.id == '5766ee65-0f6e-42fa-b932-a26b3bbb1636' %} {% if group.id == '5766ee65-0f6e-42fa-b932-a26b3bbb1636' %}
@ -35,15 +48,7 @@
</div> </div>
</div> </div>
</div> </div>
{% elsif group.id == '' %} {% unless group.id = '' %}
{% comment %}
<------------------------------->
Jenelle, similar to above for Cornerstone, please add your carousel items here!
<------------------------------->
{% endcomment %}
{% endif %}
{% endfor %}
{% endif %}
<div class="feature-card-wrapper"> <div class="feature-card-wrapper">
<div class="feature-card-container"> <div class="feature-card-container">
<div class="feature-card-content feature-content"> <div class="feature-card-content feature-content">
@ -127,4 +132,8 @@
</div> </div>
</div> </div>
</div> </div>
{% endunless %}
{% endif %}
{% endfor %}
{% endif %}

View File

@ -1,44 +1,70 @@
{% assign content_counter = 0 %} {% assign content_counter = 0 %}
{% for course in courses.in_catalog %} {% if current_person.groups.any? %}
{% for category in course.categories %} {% for group in current_person.groups %}
{% if category.name == 'Recommended' %} {% for course in courses.in_catalog %}
{% for category in course.categories %}
{% if group.id = '' and category.name = 'Recommended - ' %}
{% assign content_counter = content_counter | plus: 1 %}
{% elsif category.name == 'Recommended' %}
{% assign content_counter = content_counter | plus: 1 %} {% assign content_counter = content_counter | plus: 1 %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% for learning_path in learning_paths.available %} {% endfor %}
{% for category in learning_path.categories %} {% endif %}
{% if category.name == 'Recommended' %} {% if current_person.groups.any? %}
{% assign content_counter = content_counter | plus: 1 %} {% for group in current_person.groups %}
{% endif %} {% for learning_path in learning_paths.available %}
{% endfor %} {% for category in learning_path.categories %}
{% endfor %} {% if group.id = '' and category.name = 'Recommended - ' %}
{% assign content_counter = content_counter | plus: 1 %}
{% elsif category.name == 'Recommended' %}
{% assign content_counter = content_counter | plus: 1 %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
{% comment %} {% comment %}
To add for Chubb:
If person is in group show certain courses.
{% endcomment%} {% endcomment%}
<div class="recommended-carousel-wrapper"> <div class="recommended-carousel-wrapper">
<div class="recommended-carousel"> <div class="recommended-carousel">
{% for course in courses.in_catalog%} {% if current_person.groups.any? %}
{% for category in course.categories %} {% for group in current_person.groups %}
{% if category.name == 'Recommended' %} {% for course in courses.in_catalog%}
<div class="carousel-card-container"> {% for category in course.categories %}
{% include "cards_course" with course %} {% if group.id = '' and category.name = 'Recommended - ' %}
</div> <div class="carousel-card-container">
{% endif %} {% include "cards_course" with course %}
{% endfor %} </div>
{% endfor %} {% elsif category.name == 'Recommended' %}
{% for learning_path in learning_paths.available %} <div class="carousel-card-container">
{% for category in learning_path.categories %} {% include "cards_course" with course %}
{% if category.name == 'Recommended' %} </div>
<div class="carousel-card-container"> {% endif %}
{% include "cards_learning_path" %} {% endfor %}
</div> {% endfor %}
{% endif %} {% endfor %}
{% endfor %} {% endif %}
{% endfor %} {% if current_person.groups.any? %}
{% for group in current_person.groups %}
{% for learning_path in learning_paths.available %}
{% for category in learning_path.categories %}
{% if group.id = '' and category.name = 'Recommended - ' %}
<div class="carousel-card-container">
{% include "cards_learning_path" %}
</div>
{% elsif category.name == 'Recommended' %}
<div class="carousel-card-container">
{% include "cards_learning_path" %}
</div>
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endif %}
</div> </div>
</div> </div>

Binary file not shown.

View File

@ -4,7 +4,7 @@ import pprint
import csv import csv
pp = pprint.PrettyPrinter(indent=4) pp = pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.EMPLOY APIKEY = Apikeys.SUPPLIERPROD
HEADERS = { HEADERS = {
"accept": "application/json", "accept": "application/json",
"X-Api-Key": APIKEY, "X-Api-Key": APIKEY,
@ -22,8 +22,8 @@ def get_courses():
while True: while True:
# for course_name in COURSES: # for course_name in COURSES:
count += 1 count += 1
# url = f"https://api.northpass.com/v2/courses/?filter[name][eq]={course_name}" # url = f"https://api2.northpass.com/v2/courses/?filter[name][eq]={course_name}"
url = f"https://api.northpass.com/v2/courses/?limit=100&page={count}" url = f"https://api2.northpass.com/v2/courses/?limit=100&page={count}"
response = requests.get(url, headers=HEADERS) response = requests.get(url, headers=HEADERS)
response = response.json() response = response.json()
nextlink = response["links"] nextlink = response["links"]
@ -41,14 +41,14 @@ def get_courses():
break break
pp.pprint(list_of_ids) pp.pprint(list_of_ids)
# print(len(list_of_ids)) print(len(list_of_ids))
# with open( with open(
# "/Users/normrasmussen/Downloads/LuminateUS-Courses.csv", "a+", newline='\n' "/Users/normrasmussen/Downloads/Supplier-Courses.csv", "a+", newline='\n'
# ) as csvfile: ) as csvfile:
# for group in list_of_ids: for group in list_of_ids:
# for key, value in group.items(): for key, value in group.items():
# csvwriter = csv.writer(csvfile) csvwriter = csv.writer(csvfile)
# csvwriter.writerow([key, value]) csvwriter.writerow([key, value])
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -2,8 +2,8 @@ import requests
import Apikeys import Apikeys
import pandas as pd import pandas as pd
BASEURL = "https://api.northpass.com/v2/" BASEURL = "https://api2.northpass.com/v2/"
APIKEY = Apikeys.SKAN APIKEY = Apikeys.SUPPLIERPROD
HEADERS = {"X-Api-Key": APIKEY, "accept": "application/json"} HEADERS = {"X-Api-Key": APIKEY, "accept": "application/json"}
LISTGROUPS = "groups/" LISTGROUPS = "groups/"
@ -27,7 +27,10 @@ def get_groups():
if "next" not in nextlink: if "next" not in nextlink:
break break
get_memberships(groups_list) # get_memberships(groups_list)
df = pd.DataFrame.from_records(groups_list)
print(df)
df.to_csv("~/Downloads/Supplier_Groups.csv")
def get_memberships(groups_list): def get_memberships(groups_list):