add year to YAML data

master
Marek Isalski 6 years ago
parent 632d165eae
commit e98e5143e2

@ -90,6 +90,10 @@ class Event( Index ):
def set_slug( self, slug ): def set_slug( self, slug ):
self.fields[ '$slug' ] = 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 ): def set_published( self, published ):
if not self.fields.get( '$date' ): if not self.fields.get( '$date' ):
self.fields[ '$date' ] = {} self.fields[ '$date' ] = {}

@ -85,6 +85,7 @@ def mattermost_incident_command( command, args, channel_id, raw_incident_number,
ev.set_title( channel[ 'purpose' ] ) ev.set_title( channel[ 'purpose' ] )
ev.set_slug( raw_incident_number ) ev.set_slug( raw_incident_number )
ev.set_published( datetime.datetime.utcnow().strftime( "%Y-%m-%d %H:%M" ) ) ev.set_published( datetime.datetime.utcnow().strftime( "%Y-%m-%d %H:%M" ) )
ev.set_year( datetime.datetime.utcnow().strftime( "%Y" ) )
written = ev.write() written = ev.write()
app.mm.posts.create_post( options = { 'channel_id': private_channel_id, app.mm.posts.create_post( options = { 'channel_id': private_channel_id,

Loading…
Cancel
Save