Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from VandyHacks/kwuang-dev
Browse files Browse the repository at this point in the history
Admin page improvements, alt tag to email images
  • Loading branch information
cktang88 authored Sep 28, 2018
2 parents 3815c82 + 2bea517 commit 301c9d5
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 34 deletions.
38 changes: 37 additions & 1 deletion app/client/assets/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions app/client/src/services/UserService.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ angular.module('app')
},

getPage: function (page, size, text, showUnsubmitted) {
if (!page || page < 0) {
page = 0;
}
if (!size || size < 0) {
size = 25;
}
return $http.get(users + '?' + $.param(
{
text,
showUnsubmitted,
page: page || 0,
size: size || 50
page,
size
})
);
},
Expand Down
57 changes: 46 additions & 11 deletions app/client/views/admin/stats/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,60 +201,72 @@
<div class="item">
<i class="female icon"></i>
<div class="content">
<strong>Female</strong>: {{stats.demo.gender['F']}} ({{stats.demo.gender['F'] / stats.total * 100 |
<strong>Female</strong>: {{stats.demo.gender['F']}} ({{stats.demo.gender['F'] / stats.submitted * 100 |
number:1}}%)
</div>
</div>
<div class="item">
<i class="male icon"></i>
<div class="content">
<strong>Male</strong>: {{stats.demo.gender['M']}} ({{stats.demo.gender['M'] / stats.total * 100 |
<strong>Male</strong>: {{stats.demo.gender['M']}} ({{stats.demo.gender['M'] / stats.submitted * 100 |
number:1}}%)
</div>
</div>
<div class="item">
<i class="other gender icon"></i>
<div class="content">
<strong>Other</strong>: {{stats.demo.gender['O']}} ({{stats.demo.gender['O'] / stats.total * 100 |
<strong>Other</strong>: {{stats.demo.gender['O']}} ({{stats.demo.gender['O'] / stats.submitted * 100 |
number:1}}%)
</div>
</div>
<div class="item">
<i class="question icon"></i>
<div class="content">
<strong>Did not respond</strong>: {{stats.demo.gender['N']}} ({{stats.demo.gender['N'] / stats.total * 100 |
<strong>Did not respond</strong>: {{stats.demo.gender['N']}} ({{stats.demo.gender['N'] / stats.submitted * 100 |
number:1 }}%)
</div>
</div>
</div>
<div class="ui divider"></div>
<div class="ui list">
<div class="item">
<strong>Fresh:</strong> {{stats.demo.year['2022']}} ({{stats.demo.year['2022'] / stats.total * 100 | number:
<strong>Fresh:</strong> {{stats.demo.year['2022']}} ({{stats.demo.year['2022'] / stats.submitted * 100 | number:
1}}%)
</div>
<div class="item">
<strong>Soph:</strong> {{stats.demo.year['2021']}} ({{stats.demo.year['2021'] / stats.total * 100 | number:
<strong>Soph:</strong> {{stats.demo.year['2021']}} ({{stats.demo.year['2021'] / stats.submitted * 100 | number:
1}}%)
</div>
<div class="item">
<strong>Junior:</strong> {{stats.demo.year['2020']}} ({{stats.demo.year['2020'] / stats.total * 100 | number:
<strong>Junior:</strong> {{stats.demo.year['2020']}} ({{stats.demo.year['2020'] / stats.submitted * 100 | number:
1}}%)
</div>
<div class="item">
<strong>Senior:</strong> {{stats.demo.year['2019']}} ({{stats.demo.year['2019'] / stats.total * 100 | number:
<strong>Senior:</strong> {{stats.demo.year['2019']}} ({{stats.demo.year['2019'] / stats.submitted * 100 | number:
1}}%)
</div>
<div class="item">
<strong>Graduating in 2018:</strong> {{stats.demo.year['2018']}} ({{stats.demo.year['2018'] / stats.total * 100
<strong>Graduating in 2018:</strong> {{stats.demo.year['2018']}} ({{stats.demo.year['2018'] / stats.submitted * 100
| number: 1}}%)
</div>
</div>
<div class="ui divider"></div>
<h3>Majors: </h3>
<div>
Computer Science: {{stats.majors['Computer Science']}}
</div>
<div>
Computer Engineering: {{stats.majors['Computer Engineering']}}
</div>
<div>
Mathematics: {{stats.majors['Mathematics']}}
</div>
<div class="ui divider"></div>
<h3>Schools (top {{stats.demo.topSchools.length}})</h3>
<div class="ui list">
<div class="item" ng-repeat="school in stats.demo.schools | orderBy: '-count'">
<div class="item" ng-repeat="school in stats.demo.topSchools | orderBy: '-count'">
<div>
<strong>{{school.email}}</strong> : {{school.count}} ({{school.count / stats.total * 100 | number: 1}}%)
<strong>{{school.email}}</strong> : {{school.count}} ({{school.count / stats.submitted * 100 | number: 1}}%)
<div class="ui purple mini label">
Submitted: {{school.stats.submitted}}
</div>
Expand All @@ -271,6 +283,29 @@
</div>
</div>
</div>


<button ng-click="showMore = !showMore">Show {{stats.demo.nonTopSchools.length}} more</button>
<table ng-show="showMore" class="ui celled selectable compact users table">
<thead>
<tr>
<th>School</th>
<th>Stats</th>
</tr>
</thead>
<tbody>
<tr class="item" ng-repeat="school in stats.demo.nonTopSchools | orderBy: '-count'">
<td>
<strong>
{{school.email}}
</strong>
</td>
<td>{{school.stats.submitted}}, {{school.stats.admitted}}, {{school.stats.confirmed}},
{{school.stats.declined}}</td>
</tr>
</tbody>
</table>

</div>

<!-- <div
Expand Down
2 changes: 1 addition & 1 deletion app/client/views/admin/users/adminUsersCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ angular.module('app')
refreshPage();
});
$scope.$watch('pageNum', (pageNum) => {
$stateParams.page = pageNum;
$stateParams.page = pageNum - 1; // convert to zero-index
refreshPage();
});

Expand Down
23 changes: 7 additions & 16 deletions app/client/views/admin/users/users.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
Page Number:
<div class="ui icon fluid input">
<input type="text"
placeholder="0"
placeholder="1"
ng-model="pageNum"
ng-model-options="{debounce: 300}">
/{{pages-1}}
/{{pages}}
</div>
</div>
<div class="ui checkbox">
Expand Down Expand Up @@ -187,20 +187,11 @@ <h3> {{section.title}} </h3>
</td>

<!-- Volunteer -->
<td
class="collapsing">

<span ng-if="user.status.confirmed">
<i
ng-if="user.profile.volunteer"
class="home icon">
</i>
<i
ng-if="!user.profile.volunteer"
class="no icon">
</i>
</span>

<td class="collapsing">
<i
ng-if="user.profile.volunteer"
class="circle icon">
</i>
</td>

<td
Expand Down
15 changes: 15 additions & 0 deletions app/server/services/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ function calculateStats() {
}
},

majors: {},

teams: {},
verified: 0,
submitted: 0,
Expand Down Expand Up @@ -124,6 +126,16 @@ function calculateStats() {
// Count the number of people who want hardware
newStats.wantsHardware += user.confirmation.wantsHardware ? 1 : 0;

if (user.profile.majors) {
user.profile.majors.split(',').forEach(major => {
major = String(major);
if (!newStats.majors[major]) {
newStats.majors[major] = 0;
}
newStats.majors[major] += 1;
});
}

// Count schools
if (!newStats.demo.schools[email]) {
newStats.demo.schools[email] = {
Expand Down Expand Up @@ -201,6 +213,9 @@ function calculateStats() {
});
});
newStats.demo.schools = schools;
const TOP_SCHOOL_LIMIT = 10;
newStats.demo.topSchools = schools.filter(s => s.stats.submitted >= TOP_SCHOOL_LIMIT);
newStats.demo.nonTopSchools = schools.filter(s => s.stats.submitted < TOP_SCHOOL_LIMIT);

// Likewise, transform the teams into an array of objects
// var teams = [];
Expand Down
2 changes: 1 addition & 1 deletion app/server/templates/email-basic/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader">
<tr>
<td valign="top" class="headerContent">
<img src="{{ emailHeaderImage }}" style="max-width:600px;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext />
<img src="{{ emailHeaderImage }}" alt="VandyHacks Header Image" style="max-width:600px;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext />
</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion app/server/templates/email-link-action/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader">
<tr>
<td valign="top" class="headerContent">
<img src="{{ emailHeaderImage }}" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext
<img src="{{ emailHeaderImage }}" alt="VandyHacks Header Image" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext
/>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion app/server/templates/email-verify/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader">
<tr>
<td valign="top" class="headerContent">
<img src="{{ emailHeaderImage }}" style="max-width:600px;" id="headerImage" mc:label="header_image" mc:edit="header_image"
<img src="{{ emailHeaderImage }}" alt="VandyHacks Header Image" style="max-width:600px;" id="headerImage" mc:label="header_image" mc:edit="header_image"
mc:allowdesigner mc:allowtext />
</td>
</tr>
Expand Down

0 comments on commit 301c9d5

Please sign in to comment.