Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Conversation

@edavey
Copy link

@edavey edavey commented Nov 24, 2020

Our dxw-support-rota.herokuapp.com middleware which
provides support information from Opsgenie represents
support periods in two differnt ways, according to the
lables given to the team members' roles.

The 'Support' rotation element has a different shape to the
'OOH'rotation:

'support' rotation shape:

fromhttps://dxw-support-rota.herokuapp.com/support/rota.json

  {
    start_date: '2020-01-09',
    end_date: '2020-01-16',
    developer: { name: 'Sandy', email: 'sandy@example.com' },
    ops: { name: 'Frances', email: 'frances@example.com' }
  }

'ooh' rotation shape:

from https://dxw-support-rota.herokuapp.com/out-of-hours/rota.json

  {
    start_date: '2020-01-09',
    end_date: '2020-01-16',
    first_line: { name: 'Eve', email: 'eve@example.com' },
    second_line: { name: 'Trent', email: 'trent@example.com' }
  }

At present the RotaAlerts.run() function expects both types of rota representation to have first_line and second_line properties, and so blows up when it encounters the in-hours "Support" type.

beeLexington and others added 5 commits November 19, 2020 10:55
...and add formatting to the rotation 'description' so that
it's easy -- at a glance -- to pick out the key info, e.g.
I'm going onto:

- the "out of hours" rota
- in the "second line" role
Our `dxw-support-rota.herokuapp.com` middleware which
provides support information from Opsgenie represents
support periods in two differnt ways, according to the
lables given to the team members' roles.

The 'Support' rotation element has a different shape to the
'OOH'rotation:

'support' rotation shape:

from
https://dxw-support-rota.herokuapp.com/support/rota.json

  {
    start_date: '2020-01-09',
    end_date: '2020-01-16',
    developer: { name: 'Sandy', email: 'sandy@example.com' },
    ops: { name: 'Frances', email: 'frances@example.com' }
  }

'ooh' rotation shape:

from https://dxw-support-rota.herokuapp.com/out-of-hours/rota.json

  {
    start_date: '2020-01-09',
    end_date: '2020-01-16',
    first_line: { name: 'Eve', email: 'eve@example.com' },
    second_line: { name: 'Trent', email: 'trent@example.com' }
  }

Here we describe how we'd like the `UpcomingRotation` class
to return consistently shaped rotation *entities* to
`RotaAlerts` in order to facilitate:

- handling of rotation objects via a consistent api

- inclusion of additional important info (e.g. `#role` such
  as 'second line')
If the rotations returned by `UpcomingRotations` have a
consistent shape then consumers will be able to invoke
functions in a consistent way.

INPUT (inconsistent)
--------------------

Out-of-hours:

    {
      start_date: "2020-01-01",
      end_date: "2020-01-08",
      first_line: {
        name: "Alice",
        email: "alice@example.com",
      },
      second_line: {
        name: "Bob",
        email: "bob@example.com",
      },
    }

In-hours:

    {
      start_date: "2020-01-09",
      end_date: "2020-01-16",
      developer: {
        name: "Sandy",
        email: "Sandy@example.com",
      },
      ops: {
        name: "Frances",
        email: "Frances@example.com",
      },
    }

OUTPUT (consistent)
-------------------

Out-of-hours:

      {
        start_date: "2020-01-09",
        end_date: "2020-01-16",
        members: [
          {
            rota: "out-of-hours",
            role: "first line",
            name: "Eve",
            email: "eve@example.com",
          },
          {
            rota: "out-of-hours",
            role: "second line",
            name: "Trent",
            email: "trent@example.com",
          },
        ],
      }

In-hours:

      {
        start_date: "2020-01-09",
        end_date: "2020-01-16",
        members: [
          {
            rota: "in-hours",
            role: "developer",
            name: "Sandy",
            email: "Sandy@example.com",
          },
          {
            rota: "in-hours",
            role: "ops",
            name: "Frances",
            email: "Frances@example.com",
          },
        ],
      }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants