Latest changes

This commit is contained in:
Dobie Wollert
2015-07-06 07:09:17 -04:00
parent 0d5ebb3f43
commit 4496b9c240
5 changed files with 48 additions and 5 deletions

View File

@ -201,13 +201,13 @@ function filterClientsByFrequency(month, frequency) {
Object.keys(client.frequencies).forEach(function(frequencyName) {
var monthData = client.frequencies[frequencyName];
if (monthData[month] || month === undefined) {
if (month ? monthData[month] : _.some(monthData, Boolean)) {
if (!frequency || frequency == frequencyName) {
enabledFrequencies.push(frequencyName);
}
}
});
if (enabledFrequencies.length > 0) {
client.frequencies = enabledFrequencies;
results.push(client);

View File

@ -23,6 +23,13 @@ module.exports = function(app, auth, piler, calendar, directory, config) {
piler.addJsFile("/js/filters.js");
piler.addJsFile("/js/services.js");
app.get('/crash', function(req, res) {
console.log('Commiting Suicide for Science!');
process.nextTick(function() {
throw new Error("Ermergerd!");
});
});
app.all('/api/*', auth.requiresApiAccess);
var posts = require('../app/controllers/posts');

View File

@ -28,6 +28,7 @@
<option value="Sterilizer - TT">Sterilizer - TT</option>
<option value="Vaporizer">Vaporizer</option>
<option value="Waste Management System">Waste Management System</option>
<option value="legacy">legacy</option>
<select>
<div class="pull-right">
<span class="toolbelt-text">Month:</span>
@ -63,7 +64,7 @@
<tr ng-show="loading"><td colspan="3" class="table-loading"><i class="loader"></i></td></tr>
<tr ng-hide="loading || pms.length"><td colspan="3" class="table-message">There is no information to display.</td></tr>
<tr ng-hide="loading" ng-repeat="pm in pms | orderBy : sort.column : sort.descending">
<td>{{pm.name}} ({{pm.identifier | uppercase}})</td>
<td><a href="/clients/{{pm._id}}">{{pm.name}} ({{pm.identifier | uppercase}})</a></td>
<td>{{pm.contacts[0].name}}</td>
<td>{{pm.contacts[0].phone}}</td>
</tr>

View File

@ -73,5 +73,37 @@ require('./config/routes')(app, auth, piler, calendar, directory, config);
GLOBAL.health = 'OK'
var port = process.env.PORT || 9000
server.listen(port)
console.log('Express app started on port ' + port)
server.on('error', function(e) {
if (e.code == 'EADDRINUSE') {
console.log('Address in use, retrying...');
setTimeout(function() {
server.close();
server.listen(port, onListen);
}, 1000);
}
});
server.listen(port, onListen);
function onListen() {
var p = new pushover({
user: 'aJmPD4KigO0vLwim76n3WqWKwbKA3k',
token: 'YxspDLz3WinbPmwBThuZXCME9QmkDb'
});
var message = {
title: 'Portal is running',
message: 'Process was reset on ' + new Date(),
sound: 'bugle'
};
p.send(message, function(err, result) {
if (err) {
log.emergency('Error while sending pushover notification');
log.emergency(err);
}
});
}

3
start_this_bitch.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
NODE_ENV='prod' node/bin/node launcher.js >> server.log