From 55f33bd467842c19dce6362936c60eccfae4eb60 Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 23 Apr 2022 22:14:27 +0000 Subject: [PATCH] Added Class.getParents --- lib/Class.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/Class.js b/lib/Class.js index b737d9f..87775bf 100644 --- a/lib/Class.js +++ b/lib/Class.js @@ -162,6 +162,17 @@ class Class { return { ids: ids, objs: students }; } + async getParents() { + const parentInters = await Promise.all(this.students.map(s => + s.getParents())); + + const parents = []; + + parentInters.forEach(pi => parents.push(...pi)); + + return parents; + } + getUsers(ids, type) { const types = { account: 'Account',