Docker

The prefered and supported way to maintain a replicable development environment is with Docker. Download Docker from their website: https://www.docker.com/products/docker-desktop/ . No subscription is required, just choose the free-est options.

Once installed, simply run the following commands from the root source code folder to get started:

docker-compose build
docker-compose up

The first time docker-compose up is run, your database will be initialized with random, seed data. This is a good start for testing functionality.

Use Cases

The app should serve as a secure store for the membership data, and should facilitate a variety of use cases:

  1. Lookup a person’s membership status
    # By name
    Person.find_by(last_name: 'Nomo').status.name
    => "member"
    
    # By email
    Person.joins(:contacts).where(contact: {email: 'nomo@gmail.com'}).first.status.name
    => "member"
    
  2. Get a person’s contact information
    Person.find_by(last_name: 'Nomo').contacts
    => 
    [#<Contact:0x0000ffff80a67220
      id: 126,
      address: "123 Fake St",
      city_id: 5,
      state_id: 1,
      zipcode: "95555",
      phone: "123-456-7890",
      email: "jorge.conseco@att.net",
      primary: true,
      person_id: 126]
    
  3. Lookup the donation history for any given member
    Person.find_by(id: 42).donations
    
  4. Lookup a person’s membership renewal history
    Person.find_by(id: 42).memberships
    
  5. Lookup when a person first joined
    Person.find_by(id: 42).memberships.order(start: :asc).first.start
    => Sat, 21 Sep 2019 00:00:00.000000000 UTC +00:00
    
  6. Lookup when a person’s membership expires
    membership = Person.find_by(id: 42).memberships.order(start: :desc).first
    expiration = membership.start + membership.term_months.months
    => Mon, 24 Nov 2025 00:00:00.000000000 UTC +00:00
    
  7. Find members whose memberships have lapsed
    # All expired memberships
    Person.lapsed_members
    
    # Expired memberships who still have the "member" standing
    Person.lapsed_members(status: 'member')