-
-
Notifications
You must be signed in to change notification settings - Fork 46
Home
radhikamalik edited this page Sep 8, 2015
·
2 revisions
#Code Base Overview
The app shows (Subway/BRT/Rail) Lines on the landing page, their direction(Inbound/Outbound).
Click on a line and a direction and get a list of stops with events and issues that are shared real-time across all users. You can add an event/or issue and watch it propagate to other clients
Client - client
- Loads subset of Reports into miniMongoDb with events from the line selected.
- Adds issues to the MiniMongoDb on the client machine and pushes back to the master on the server which distributes it to the others.
Server - /lib/server.js
- Runs a service(synchedCronJob) that decrements weights every minute & expires reports
Weight decays by 1 every min. Upvote a report adds 10, with a ceiling of 20.(+10) Downvotes decriment weight by 5(-5) Initial Weight on New Reports is 20 Initial settings for this are found [lib/config.js] Expires Reports that are negative or 0.
- If you submit the same event for the same station, it just adds to the confirms and doesn't allow people to upvote their own submissions (based on session from browser)
MongoDb - /lib/report.js
Has a collection of Reports
Example:
{
"_id":"3mCEDZ8EsgCeMR8xy",
"name":"Delayed train",
"location":"Alewife",
"line":"Red Line - Northbound",
"votes":0,
"clears":0,
"createdAt":"2015-03-21T15:41:52.924Z",
"lastConfirmedAt":"2015-03-21T15:41:52.924Z",
"expired":false,
"weight":12
}