Supplier script for group and course associations.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
{% if group.id == '2d93e49d-48e0-4419-baf8-88f31ad78349' %}
|
{% if group.id == '2d93e49d-48e0-4419-baf8-88f31ad78349' %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
< ----------------------------->
|
< ----------------------------->
|
||||||
The carousel HTML goes here.
|
The carousel for the access agent group goes here.
|
||||||
< ----------------------------->
|
< ----------------------------->
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
<div class="feature-card-wrapper">
|
<div class="feature-card-wrapper">
|
||||||
@ -48,6 +48,11 @@
|
|||||||
{% 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' %}
|
||||||
|
{% comment %}
|
||||||
|
< ----------------------------->
|
||||||
|
The carousel for the Cornerstone group goes here.
|
||||||
|
< ----------------------------->
|
||||||
|
{% endcomment %}
|
||||||
<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">
|
||||||
@ -83,6 +88,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% comment %}
|
||||||
|
< ----------------------------->
|
||||||
|
The carousel for the remainder of the groups.
|
||||||
|
< ----------------------------->
|
||||||
|
{% endcomment %}
|
||||||
<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">
|
||||||
|
|||||||
@ -9,13 +9,35 @@ BASEFILE = "~/Downloads/Supplier Academy Course Groupings.csv"
|
|||||||
|
|
||||||
def parse_csv():
|
def parse_csv():
|
||||||
df = pd.read_csv(BASEFILE)
|
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')
|
groups = df.groupby('group_uuid')
|
||||||
for key,item in groups:
|
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"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__":
|
if __name__ == "__main__":
|
||||||
parse_csv()
|
parse_csv()
|
||||||
|
|||||||
Reference in New Issue
Block a user