add more calculator logic

This commit is contained in:
Quincy Larson
2015-06-24 09:44:30 -07:00
parent e2deaa3f9d
commit 09656a0f34
3 changed files with 248 additions and 2 deletions

3
app.js
View File

@ -239,6 +239,9 @@ app.get('/chat', resourcesController.chat);
app.get('/twitch', resourcesController.twitch); app.get('/twitch', resourcesController.twitch);
app.get('/coding-bootcamp-cost-calculator', resourcesController.bootcampCalculator);
app.get('/coding-bootcamp-cost-calculator.json', resourcesController.bootcampCalculatorJson);
app.get('/cats.json', function(req, res) { app.get('/cats.json', function(req, res) {
res.send( res.send(
[ [

231
controllers/bootcamps.json Normal file
View File

@ -0,0 +1,231 @@
[
{
"name": "Hack Reactor",
"cost": "17780",
"housing": "500",
"weeks": "12",
"finance": true,
"cities": [
"new-york-city",
"san-francisco"
]
}, {
"name": "Hack Reactor Online",
"cost": "17780",
"housing": "0",
"weeks": "12",
"finance": true,
"cities": [
"online"
]
}, {
"name": "Hackbright Academy",
"cost": "15000",
"housing": "500",
"weeks": "10",
"finance": true,
"cities": [
"san-francisco"
]
}, {
"name": "Dev Bootcamp",
"cost": "13950",
"finance": true,
"housing": "500",
"weeks": "19",
"cities": [
"new-york-city",
"san-francisco",
"chicago"
]
}, {
"name": "General Asssembly",
"cost": "11500",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"washington-dc",
"austin",
"boston",
"chicago",
"hong-kong",
"london",
"los-angeles",
"melbourne",
"new-york-city",
"san-francisco",
"seattle",
"singapore"
]
}, {
"name": "Angel Hack",
"cost": "14250",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"san-francisco"
]
}, {
"name": "Bitmaker Labs",
"cost": "12000",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"toronto"
]
}, {
"name": "CoderVox",
"cost": "9980",
"housing": "400",
"finance": true,
"weeks": "12",
"cities": [
"austin"
]
}, {
"name": "Coding Dojo",
"cost": "12500",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"new-york-city",
"san-francisco",
"chicago"
]
}, {
"name": "Epicodus",
"cost": "4500",
"housing": "400",
"finance": false,
"weeks": "15",
"cities": [
"portland"
]
}, {
"name": "Flat Iron School",
"cost": "15000",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"new-york-city"
]
}, {
"name": "Galvanize",
"cost": "21000",
"housing": "500",
"finance": true,
"weeks": "24",
"cities": [
"boulder",
"denver",
"seattle",
"san-francisco"
]
}, {
"name": "The Iron Yard",
"cost": "12000",
"housing": "500",
"finance": true,
"weeks": "19",
"cities": [
"austin",
"washington-dc",
"raleigh-durham",
"atlanta"
]
}, {
"name": "Launch Academy",
"cost": "12500",
"housing": "500",
"finance": true,
"weeks": "10",
"cities": [
"boston"
]
}, {
"name": "Maker Square",
"cost": "16920",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"los-angeles",
"san-francisco",
"austin"
]
}, {
"name": "Refactor U",
"cost": "13500",
"housing": "400",
"finance": true,
"weeks": "10",
"cities": [
"boulder"
]
}, {
"name": "Rocket U",
"cost": "12500",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"new-york-city",
"san-francisco",
"chicago"
]
}, {
"name": "Sabio",
"cost": "13450",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"los-angeles"
]
}, {
"name": "Shillington School",
"cost": "12950",
"housing": "500",
"finance": true,
"weeks": "12",
"cities": [
"new-york-city",
"sydney",
"brisbane",
"london",
"manchester",
"melbourne"
]
}, {
"name": "The Tech Academy",
"cost": "9000",
"housing": "400",
"finance": true,
"weeks": "20",
"cities": [
"portland"
]
}, {
"name": "Turing School",
"cost": "17500",
"housing": "400",
"finance": true,
"weeks": "27",
"cities": [
"denver"
]
}, {
"name": "Free Code Camp",
"cost": "0",
"housing": "0",
"finance": false,
"weeks": "0",
"cities": [
"online"
]
}]

View File

@ -8,8 +8,7 @@ var async = require('async'),
R = require('ramda'), R = require('ramda'),
_ = require('lodash'), _ = require('lodash'),
fs = require('fs'), fs = require('fs'),
bootcampJson = require('./bootcamps.json'),
constantStrings = require('./constantStrings.json'), constantStrings = require('./constantStrings.json'),
User = require('../models/User'), User = require('../models/User'),
Challenge = require('./../models/Challenge'), Challenge = require('./../models/Challenge'),
@ -247,6 +246,8 @@ module.exports = {
); );
}, },
nonprofits: function nonprofits(req, res) { nonprofits: function nonprofits(req, res) {
res.render('resources/nonprofits', { res.render('resources/nonprofits', {
title: 'A guide to our Nonprofit Projects' title: 'A guide to our Nonprofit Projects'
@ -277,6 +278,17 @@ module.exports = {
}); });
}, },
bootcampCalculator: function bootcampCalculator(req, res) {
res.render('resources/calculator', {
title: 'Coding Bootcamp Cost Calculator',
bootcampJson: bootcampJson
});
},
bootcampCalculatorJson: function bootcampCalculatorJson(req, res) {
res.send(bootcampJson);
},
unsubscribe: function unsubscribe(req, res, next) { unsubscribe: function unsubscribe(req, res, next) {
User.findOne({ email: req.params.email }, function(err, user) { User.findOne({ email: req.params.email }, function(err, user) {
if (user) { if (user) {