Finished Datasnipper script. Some template stuff.

This commit is contained in:
Norm Rasmussen
2024-09-06 16:05:32 -04:00
parent d4fdd5702b
commit 030787e01c
6 changed files with 79 additions and 14 deletions

View File

@ -257,4 +257,4 @@
height: 25em;
justify-content: center;
}
</style>
</style>

View File

@ -13,7 +13,7 @@
<img src="https://i.imgur.com/TayoEHg.png" style="width: 500px">
</div>
<div class="np-homepage-subheadline np-header-font-color">
{{ nothing.subheadline }}
{{ current_school.name }}
</div>
</div>
</div>
@ -22,10 +22,10 @@
<div class="np-homepage-featured np-max-width">
<div class="np-homepage-featured-text">
<div class="np-homepage-headline">
{{ homepage.featured_courses_headline }}
{{ homepage.headline }}
</div>
<div class="np-homepage-subheadline">
{{ homepage.featured_courses_subheadline }}
{{ homepage.subheadline }}
</div>
</div>
{% if courses.in_catalog.any? %}
@ -50,6 +50,7 @@
</div>
{% endif %}
</div>
{% comment %}
{% include "section_popular_topics" %}
{% include "section_professionals" %}
@ -57,6 +58,7 @@
{% include "section_faqs" %}
{% include "section_instructors" %}
{% endcomment %}
</main>
{% include "footer" %}

View File

@ -35,6 +35,7 @@
{% else %}
<a href="{% route home %}" class="np-school-name np-header-font-color">
{{ current_school.name }}
{{ current_school.url }}
</a>
{% endif %}

View File

@ -0,0 +1,52 @@
{% include "header" %}
{% include "course_version_outdated_alert", courses: courses.featured %}
<main class="np-main np-homepage">
<div class="np-homepage-hero">
<img class="np-homepage-hero-image"
src="{{ homepage.artwork_url }}"
alt="{{ homepage.headline }}"
/>
<div class="np-homepage-hero-content">
<div class="np-homepage-headline np-header-font-color">
{{ current_school.request_access_link }}
</div>
<div class="np-homepage-subheadline np-header-font-color">
{{ homepage.subheadline }}
</div>
<a class="np-homepage-hero-cta np-button" href="{% route catalog %}">
{% t .discover %}
</a>
</div>
</div>
{% include "sub_navigation" %}
<div class="np-homepage-featured np-max-width">
<div class="np-homepage-featured-text">
<div class="np-homepage-headline">
{{ homepage.featured_courses_headline }}
</div>
<div class="np-homepage-subheadline">
{{ homepage.featured_courses_subheadline }}
</div>
</div>
{% if courses.featured.any? %}
<div class="np-homepage-featured-courses row">
{% for course in courses.featured %}
<div class="col-xs-12 col-md-6 col-lg-4 np-stretch-content">
{% include "cards_course" with course %}
</div>
{% endfor %}
</div>
{% else %}
<div class="np-homepage-featured-empty">
<div class="np-zero-state-text">
{% t .empty, key: current_school.course_vocabulary %}
</div>
<img
class="np-zero-state-courses"
alt="{% t .empty, key: current_school.course_vocabulary %}"
/>
</div>
{% endif %}
</div>
</main>
{% include "footer" %}

View File

@ -4,12 +4,14 @@ import requests
APIKEY = Apikeys.DATASNIPPER
BASEURL = "https://api.northpass.com/v2"
HEADERS = { "content-type": "appliation/json", "X-Api-Key": APIKEY }
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
PP = pprint.PrettyPrinter(indent=4)
ALL_LEARNERS_GROUP = "2e274dc7-3abe-4575-8b3d-0c8e73a09f44"
def grab_people():
count = 0
emptylist = []
while True:
count += 1
url = f"{BASEURL}/people?page={count}"
@ -18,18 +20,26 @@ def grab_people():
nextlink = resp["links"]
for peeps in resp["data"]:
id = peeps["id"]
learner_id = peeps["id"]
email = peeps["attributes"]["email"]
groups = peeps["relationships"]["groups"]
if len(groups['data']) >= 2:
for y in groups['data']:
if ALL_LEARNERS_GROUP in y['id']:
print(email, id)
# if 'ecb95453-7196-4392-8a24-392bf14b0480' in y:
if len(groups["data"]) >= 2:
for y in groups["data"]:
if ALL_LEARNERS_GROUP in y["id"]:
group_uuid = y["id"]
remove_person_from_group(learner_id, group_uuid)
if "next" not in nextlink:
break
def remove_person_from_group(learner_id, group_id):
remove_url = f"{BASEURL}/people/{learner_id}/relationships/groups"
print(remove_url)
group_payload = {"data": [{"id": group_id, "type": "membership-groups"}]}
print(group_payload)
remove_call = requests.delete(remove_url, headers=HEADERS, json=group_payload)
print(remove_call.status_code)
if __name__ == "__main__":
grab_people()

View File

@ -372,7 +372,7 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th
## 07-17-2024
- [X] Chubb - Send Steve Google App Script & ask Kim what report she needs
- [ ] Chubb - Ask SE for Delivery Log export from db. They are trying to find the best way to reminder agents who haven't started anything to actually start the path. Include all the data.
- [X] Chubb - Ask SE for Delivery Log export from db. They are trying to find the best way to reminder agents who haven't started anything to actually start the path. Include all the data.
- [X] Volt - They would like an Archive Webhook. "It's necessary for the whole equation of getting everything up to enterprise level standards." No rush but it would help fill in the whole circle.
- [X] HH - Looker: Course Completion, only yes, last 24 hours, scheduled for "results are changed" and 8am every day.
@ -398,7 +398,7 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th
- [ ] REVIEW - VOs:
- [ ] Quantitative - 80%, Qualitative - 100% - Mid-year Baselines 3 VOs out of 18 current customers
- [ ] Williams-Sonoma - Big Wishlist item is native survey tool.
- [X] Williams-Sonoma - Big Wishlist item is native survey tool.
## 08-14-2024