Supplier script for group and course associations.

This commit is contained in:
Norm Rasmussen
2025-03-13 14:15:03 -04:00
parent 4addc47565
commit 5170459186
2 changed files with 36 additions and 4 deletions

View File

@ -3,7 +3,7 @@
{% if group.id == '2d93e49d-48e0-4419-baf8-88f31ad78349' %}
{% comment %}
< ----------------------------->
The carousel HTML goes here.
The carousel for the access agent group goes here.
< ----------------------------->
{% endcomment %}
<div class="feature-card-wrapper">
@ -48,6 +48,11 @@
{% if current_person.groups.any? %}
{% for group in current_person.groups %}
{% if group.id == '5766ee65-0f6e-42fa-b932-a26b3bbb1636' %}
{% comment %}
< ----------------------------->
The carousel for the Cornerstone group goes here.
< ----------------------------->
{% endcomment %}
<div class="feature-card-wrapper">
<div class="feature-card-container">
<div class="feature-card-content feature-content">
@ -83,6 +88,11 @@
</div>
</div>
{% else %}
{% comment %}
< ----------------------------->
The carousel for the remainder of the groups.
< ----------------------------->
{% endcomment %}
<div class="feature-card-wrapper">
<div class="feature-card-container">
<div class="feature-card-content feature-content">

View File

@ -9,13 +9,35 @@ BASEFILE = "~/Downloads/Supplier Academy Course Groupings.csv"
def parse_csv():
df = pd.read_csv(BASEFILE)
unique_groups = df['group_uuid'].nunique()
unique_groups = df['group_uuid'].unique().tolist()
unique_group_name = df['group_name'].unique().tolist()
groups = df.groupby('group_uuid')
for key,item in groups:
print(groups.get_group(key), "\n\n")
pass
# print(groups.get_group(key), "\n\n")
print(f"Total Number of courses: {df['course_name'].nunique()}")
print(f"Number of Unique Groups: {unique_groups}")
print(unique_group_name, unique_groups)
# print(f"Number of Unique Groups: {unique_groups}")
remove_group_courses(unique_groups)
def remove_group_courses(unique_groups):
"""
From Bartosz Chodyla: There's a non-public endpoint:
/v1/group_courses/:id
where id is the UUID of a record from the group_courses table. You can get the UUIDs directly from the DB or by calling another non-public endpoint, which is:
/v1/groups/:group_uuid/courses
"""
print(unique_groups)
for group_uuid in unique_groups:
print(group_uuid)
# Get Group Courses
get_gcourses = f"https://api2.northpass.com/v1/groups/{group_uuid}/courses"
group_courses = requests.get(get_gcourses, headers=HEADERS)
gcourse_json = group_courses.json()
print(gcourse_json)
if __name__ == "__main__":
parse_csv()