Skip to content

Instantly share code, notes, and snippets.

2019-07-06 personnel v2 functionality

#29th

  • Roster
  • Members
    • Edit profile
      • Update service coat
      • Update forum display name
    • Service record
  • Promotions
@wilson29thid
wilson29thid / Dockerfile.api
Last active July 5, 2019 14:22
personnel docker
FROM php:5.5.38-apache
# Install composer (and fix package manager per https://superuser.com/a/1423685)
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends zlib1g-dev \
&& docker-php-ext-install zip
RUN curl --silent --show-error https://getcomposer.org/download/1.8.6/composer.phar > /usr/local/bin/composer \
&& chmod 755 /usr/local/bin/composer
@wilson29thid
wilson29thid / permissions_on_unit.sql
Created January 27, 2019 20:54
Personnel permission queries with common table expressions (CTEs)
with recursive unit_tree (id, name, parent_id) as (
select id, name, parent_id
from units
where id = 4 # Able-1-1
union all
select parent.id, parent.name, parent.parent_id
from unit_tree as child
join units as parent
on child.parent_id = parent.id
),
@wilson29thid
wilson29thid / gist:6416146
Last active December 22, 2015 04:19
Calculating overlapping durations
-------------------------------------------------------------------------
| id | member_id | unit_id | start_date | end_date |
-------------------------------------------------------------------------
| 1 | 2 | 23 | 2013-01-01 | 2013-02-01 |
-------------------------------------------------------------------------
| 2 | 2 | 25 | 2013-02-01 | 2013-03-01 |
-------------------------------------------------------------------------
| 3 | 2 | 27 | 2013-03-01 | NULL |
-------------------------------------------------------------------------