This is a Rails application inspired by the long toilet wait times and uncertainty about taking a crap on a certain floor in some building at some state on the continental United States.
As Brits often say:
Everybody poops... but the queen.
- Install Postgres
- Install Ruby 2.2.2
- Install bundler
- Run "bundle"
- Run "rake db:create"
- Run "rake db:migrate"
- Run "rake db:seed" to seed the database with the default group, user and a toilet.
- Run "rails s"
- Go take dat shit.
To calculate the length of all "transactions", run the following SQL:
select
id, event,
case when event = 'available' then to_char(created_at - lag(created_at) over (order by created_at), 'MI:SS') else '' end as shitting,
case when event = 'occupied' then to_char(created_at - lag(created_at) over (order by created_at), 'HH24:MI:SS') else '' end as idling
from toilet_transactions
where toilet_id = 1
and created_at > '2015-08-20 14:00:00';