From 9973b1d785c9d3c6c71ad149eb5ad5b65a6eb95d Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Fri, 3 Aug 2018 16:07:48 -0400 Subject: Updated admin so it correctly shows the divisons of students based on the value in their account/ --- src/actions/firebase.js | 14 +++++++++++--- src/components/mao-admin.js | 15 ++++++++++----- src/components/registry-element.js | 33 ++++++++++++++++++++------------- 3 files changed, 41 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/actions/firebase.js b/src/actions/firebase.js index 49d6768..83aca5e 100644 --- a/src/actions/firebase.js +++ b/src/actions/firebase.js @@ -229,10 +229,18 @@ export const snapshotAdminCompList = () => (dispatch) => { docRef.onSnapshot((querySnapshot) => { var compList = []; querySnapshot.forEach((doc) => { - compList.push({ - ...doc.data(), - name: doc.id + var divisonData = []; + for(var i = 0; i < doc.data().uids.length; i++) { + var docRefDivison = firestore.collection('users').doc(doc.data().uids[i]); + docRefDivison.get().then((docUser) => { + divisonData.push(docUser.data().divison); }); + } + compList.push({ + ...doc.data(), + name: doc.id, + divisons: divisonData + }); }); dispatch(updateAdminCompList(compList)); }); diff --git a/src/components/mao-admin.js b/src/components/mao-admin.js index dc78616..12a9e16 100644 --- a/src/components/mao-admin.js +++ b/src/components/mao-admin.js @@ -102,6 +102,13 @@ class MaoAdmin extends connect(store)(PageViewElement) { `; } + constructor() { + super(); + + this.requestsHidden = true; + this.registryHidden = true; + } + static get properties() { return { // This is the data from the store. signedIn: Boolean, @@ -121,9 +128,6 @@ class MaoAdmin extends connect(store)(PageViewElement) { this.requests = state.firebase.requests; this.registry = state.firebase.compList; - this.requestsHidden = true; - this.registryHidden = true; - this.updateInformation(); } @@ -182,8 +186,9 @@ class MaoAdmin extends connect(store)(PageViewElement) { for(var i = 0; i - +

Other

+
    +
@@ -80,8 +84,9 @@ class RegistryElement extends LitElement { } static get properties() { return { - name: String, - emails: Array, + name: String, + emails: Array, + divisions: Array, infoTabOpen: Boolean }}; @@ -89,8 +94,9 @@ class RegistryElement extends LitElement { constructor() { super(); - this.name = ""; - this.emails = []; + this.name = ""; + this.emails = []; + this.divisons = []; this.infoTabOpen = false; } @@ -108,23 +114,24 @@ class RegistryElement extends LitElement { var thetas = this.shadowRoot.getElementById('name-list-theta'); var alphas = this.shadowRoot.getElementById('name-list-alpha'); var mus = this.shadowRoot.getElementById('name-list-mu'); - //var stats = this.shadowRoot.getElementById('name-list-stats'); + var other = this.shadowRoot.getElementById('name-list-other'); thetas.innerHTML = ""; alphas.innerHTML = ""; mus .innerHTML = ""; + other .innerHTML = ""; for(var i=0; i