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:
@ -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? %}
|
||||
{% for group in current_person.groups %}
|
||||
{% if group.id == '5766ee65-0f6e-42fa-b932-a26b3bbb1636' %}
|
||||
@ -35,15 +48,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% elsif group.id == '' %}
|
||||
{% comment %}
|
||||
<------------------------------->
|
||||
Jenelle, similar to above for Cornerstone, please add your carousel items here!
|
||||
<------------------------------->
|
||||
{% endcomment %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% unless group.id = '' %}
|
||||
<div class="feature-card-wrapper">
|
||||
<div class="feature-card-container">
|
||||
<div class="feature-card-content feature-content">
|
||||
@ -127,4 +132,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@ -1,44 +1,70 @@
|
||||
{% assign content_counter = 0 %}
|
||||
|
||||
{% for course in courses.in_catalog %}
|
||||
{% for category in course.categories %}
|
||||
{% if category.name == 'Recommended' %}
|
||||
{% if current_person.groups.any? %}
|
||||
{% for group in current_person.groups %}
|
||||
{% 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 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% for learning_path in learning_paths.available %}
|
||||
{% for category in learning_path.categories %}
|
||||
{% if category.name == 'Recommended' %}
|
||||
{% assign content_counter = content_counter | plus: 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% 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 - ' %}
|
||||
{% assign content_counter = content_counter | plus: 1 %}
|
||||
{% elsif category.name == 'Recommended' %}
|
||||
{% assign content_counter = content_counter | plus: 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% comment %}
|
||||
To add for Chubb:
|
||||
If person is in group show certain courses.
|
||||
|
||||
{% endcomment%}
|
||||
<div class="recommended-carousel-wrapper">
|
||||
<div class="recommended-carousel">
|
||||
{% for course in courses.in_catalog%}
|
||||
{% for category in course.categories %}
|
||||
{% if category.name == 'Recommended' %}
|
||||
<div class="carousel-card-container">
|
||||
{% include "cards_course" with course %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% for learning_path in learning_paths.available %}
|
||||
{% for category in learning_path.categories %}
|
||||
{% if category.name == 'Recommended' %}
|
||||
<div class="carousel-card-container">
|
||||
{% include "cards_learning_path" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% if current_person.groups.any? %}
|
||||
{% for group in current_person.groups %}
|
||||
{% for course in courses.in_catalog%}
|
||||
{% for category in course.categories %}
|
||||
{% if group.id = '' and category.name = 'Recommended - ' %}
|
||||
<div class="carousel-card-container">
|
||||
{% include "cards_course" with course %}
|
||||
</div>
|
||||
{% elsif category.name == 'Recommended' %}
|
||||
<div class="carousel-card-container">
|
||||
{% include "cards_course" with course %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% 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>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4,7 +4,7 @@ import pprint
|
||||
import csv
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
APIKEY = Apikeys.EMPLOY
|
||||
APIKEY = Apikeys.SUPPLIERPROD
|
||||
HEADERS = {
|
||||
"accept": "application/json",
|
||||
"X-Api-Key": APIKEY,
|
||||
@ -22,8 +22,8 @@ def get_courses():
|
||||
while True:
|
||||
# for course_name in COURSES:
|
||||
count += 1
|
||||
# url = f"https://api.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/?filter[name][eq]={course_name}"
|
||||
url = f"https://api2.northpass.com/v2/courses/?limit=100&page={count}"
|
||||
response = requests.get(url, headers=HEADERS)
|
||||
response = response.json()
|
||||
nextlink = response["links"]
|
||||
@ -41,14 +41,14 @@ def get_courses():
|
||||
break
|
||||
|
||||
pp.pprint(list_of_ids)
|
||||
# print(len(list_of_ids))
|
||||
# with open(
|
||||
# "/Users/normrasmussen/Downloads/LuminateUS-Courses.csv", "a+", newline='\n'
|
||||
# ) as csvfile:
|
||||
# for group in list_of_ids:
|
||||
# for key, value in group.items():
|
||||
# csvwriter = csv.writer(csvfile)
|
||||
# csvwriter.writerow([key, value])
|
||||
print(len(list_of_ids))
|
||||
with open(
|
||||
"/Users/normrasmussen/Downloads/Supplier-Courses.csv", "a+", newline='\n'
|
||||
) as csvfile:
|
||||
for group in list_of_ids:
|
||||
for key, value in group.items():
|
||||
csvwriter = csv.writer(csvfile)
|
||||
csvwriter.writerow([key, value])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -2,8 +2,8 @@ import requests
|
||||
import Apikeys
|
||||
import pandas as pd
|
||||
|
||||
BASEURL = "https://api.northpass.com/v2/"
|
||||
APIKEY = Apikeys.SKAN
|
||||
BASEURL = "https://api2.northpass.com/v2/"
|
||||
APIKEY = Apikeys.SUPPLIERPROD
|
||||
HEADERS = {"X-Api-Key": APIKEY, "accept": "application/json"}
|
||||
|
||||
LISTGROUPS = "groups/"
|
||||
@ -27,7 +27,10 @@ def get_groups():
|
||||
if "next" not in nextlink:
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user