Skip to content

Instantly share code, notes, and snippets.

View caracalla's full-sized avatar
🚇
Training

James "Kimo" Florencio caracalla

🚇
Training
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<title>Learn Git</title>
</head>
<body>
<p>Press the button to make something happen:</p>
<button id="action-button">Click Me</button>
#include <iostream>
#include <cstdlib> // rand(), srand()
#include <ctime> // time()
using namespace std;
int main() {
// get the current time (time_t is basically just int)
time_t currentTime = time(nullptr);

Background

Organizers have one Account (organizer.account_id)

A Passenger belongs to one Account (passenger.account_id)

  • Accounts have many Passengers
  • Organizers have manyPassengers through their Account

Waypoints belong to one Trip (waypoint.trip_id)

  • Trips have many Waypoints

##Problem:

  • Procedures, as defined by organizers, need to be directly associated with the passenger as the organizer defines the trip.

##Solution:

  • Passengers are currently associated to Participations, which are associated to Waypoints, which are associated to Trips. Waypoints have a single Location association. Account Locations (which contain procedures) can be directly associated with Participations, in order to solve the problem.

##Challenges:

  • Currently, the intended Account Location for each Passenger is inferred by searching for the Account Location on the Passenger's associated Account with the Location matching that of the Waypoint.
  • Currently, when an Account Location is created with the same Location as an existing Account Location on the organizer's Account, the existing Account Location is overwritten.
  • Trip and Waypoint creation is accomplished through very opaque means, involving overwritten ActiveRecord methods (assign_attributes, attribute setter methods, etc). Thus, it is very dif
james@Lucifer: (6101-extra-events *$) ∫ shdl -e production rails rake db:migrate
[3.245s] running rake task...
** [Bugsnag] Bugsnag exception handler 3.0.0 ready, api_key=53f129301c9d8f302107de9d5fbd6cba
(5.6ms) SELECT f_geometry_column,coord_dimension,srid,type FROM geometry_columns WHERE f_table_name='users'
ActiveRecord::SchemaMigration Load (1.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
Migrating to CreateMongoTablesForPg (20160703150712)
(0.7ms) BEGIN
== 20160703150712 CreateMongoTablesForPg: migrating ===========================
-- create_table(:mongo_addresses, {:id=>false})
(1.0ms) CREATE TABLE "mongo_addresses" ("mid" character varying(255), "parent" character varying(255), "name" character varying(255), "lat" character varying(255), "lng" character varying(255), "addr1" character varying(255), "city" character varying(255), "state" character varying(255), "zip" character varying(255), "validity_state" character varying(255), "formatted_address" character varying(255),
shuddle=# select * from short_links where id='02bb';
id | url | click_count | created_at | updated_at | shuddle_employee_id | active | coupon | remaining | free_trips_granted | expires_at | user_type | resource_id | resource_type | deep_link | account_credit_granted | redemption_policies | coupon_redemption_count | internal_comment | type
------+------------------------------+-------------+----------------------------+----------------------------+---------------------+--------+--------+-----------+--------------------+------------+-----------+-------------+---------------+-----------+------------------------+---------------------+-------------------------+------------------+-----------------------------------
02bb | shdl-organizer://static/home | 185 | 2015-08-04 19:06:18.499833 | 2016-06-18 00:38:20.971647 | | t | f | | | | organizer | home
james@Lucifer: (5961-booking-cutoff-enforcement $) ∫ shdl db console -e production
psql (9.5.2)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
shuddle=# select * from short_links where id='organizer_schedule'
shuddle-# ;
id | url | click_count | created_at | updated_at | shuddle_employee_id | active | coupon | remaining | free_trips_granted | expires_at | user_type | account_credit_granted | resource_id | resource_type | deep_link | redemption_policies | coupon_redemption_count | internal_comment | type
--------------------+-----+-------------+----------------------------+----------------------------+---------------------+--------+--------+-----------+--------------------+------------+-----------+------------------------+-------------+---------------+-----------+---------------------+-------------------------+------------------+-----------------------
{
"trips": [{
"actual_earnings": 2000,
"actual_starts_at": "2016-03-03T15:29:03.225-08:00",
"estimated_earnings": 2200,
"id": 124377,
"state": "complete",
"time_anchor": "pick_up",
"planned_route": {
"id": 254355,
@caracalla
caracalla / infra_notes.md
Last active May 19, 2016 14:44
Infrastructure setup notes

NEED TO DO

  • set up automated database testing - ansible/roles/builder/tasks/main.yml
  • for production, create instance groups for zone a b and c
  • update google for work account for routing
  • set up google login for admin
  • set up twilio for holla
  • get admin working
  • get www working?
  • update push notifications
  • review rails env vars