From e98e5143e2a6b2a46b117049561e79f4f4498eb0 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Mon, 27 May 2019 15:05:38 +0100 Subject: [PATCH] add year to YAML data --- event.py | 4 ++++ fih.py | 1 + 2 files changed, 5 insertions(+) diff --git a/event.py b/event.py index d1813ee..dce348a 100644 --- a/event.py +++ b/event.py @@ -90,6 +90,10 @@ class Event( Index ): def set_slug( self, slug ): self.fields[ '$slug' ] = slug + def set_year( self, year ): + if not self.fields.get( 'year' ): + self.fields[ 'year' ] = year + def set_published( self, published ): if not self.fields.get( '$date' ): self.fields[ '$date' ] = {} diff --git a/fih.py b/fih.py index 4b685bd..eecdfe3 100644 --- a/fih.py +++ b/fih.py @@ -85,6 +85,7 @@ def mattermost_incident_command( command, args, channel_id, raw_incident_number, ev.set_title( channel[ 'purpose' ] ) ev.set_slug( raw_incident_number ) ev.set_published( datetime.datetime.utcnow().strftime( "%Y-%m-%d %H:%M" ) ) + ev.set_year( datetime.datetime.utcnow().strftime( "%Y" ) ) written = ev.write() app.mm.posts.create_post( options = { 'channel_id': private_channel_id,