Skip to content

Commit

Permalink
Query edubadge account
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 30, 2025
1 parent 74fefdb commit 2ff43a6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions queries/count_assertions.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
select ins.identifier, count(u.id) as user_count, (select count(bi.id) from issuer_badgeinstance bi where bi.user_id = u.id ) as assertion_count
select count(u.id) as user_count, (select count(bi.id) from issuer_badgeinstance bi where bi.user_id = u.id ) as assertion_count
from users u
inner join issuer_badgeinstance bi on bi.user_id = u.id
inner join issuer_badgeclass b on b.id = bi.badgeclass_id
inner join issuer_issuer i on i.id = b.issuer_id
inner join institution_faculty f on f.id = i.faculty_id
inner join institution_institution ins on ins.id = f.institution_id
where b.is_micro_credentials = 1 and ins.institution_type is not null
group by assertion_count, ins.identifier
order by ins.identifier ;
group by assertion_count

select count(bi.id), b.badge_class_type, b.archived from issuer_badgeinstance bi
inner join issuer_badgeclass b on b.id = bi.badgeclass_id
group by b.badge_class_type, b.archived;
group by b.badge_class_type, b.archived;

select u.email from users u where (u.validated_name is null OR u.validated_name = '') and u.is_teacher = 0
and exists(
SELECT 1
FROM issuer_badgeinstance bi INNER JOIN issuer_badgeclass bc
WHERE bi.user_id = u.id AND bc.name <> 'Edubadge account complete'
);

0 comments on commit 2ff43a6

Please sign in to comment.