From de715597b6f2b0a498d7f44988d7d7022c97ef91 Mon Sep 17 00:00:00 2001 From: Antoine WEBER Date: Tue, 22 Sep 2015 15:20:02 +0200 Subject: [PATCH] formattage des nombres --- routes/channel.js | 6 +++++- views/channel.jade | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/routes/channel.js b/routes/channel.js index 3e55d01..35d124c 100644 --- a/routes/channel.js +++ b/routes/channel.js @@ -40,9 +40,13 @@ router.get('/:id', function(req, res, next) { var tab2 = val.split('='); params[tab2[0]] = decodeURIComponent(tab2[1]); }); - row.info_meta = params; + //formattage des données + if(typeof row.info_meta !== 'undefined' && typeof row.info_meta.season !== 'undefined' && typeof row.info_meta.episode !== 'undefined'){ + row.season_episode = "S"+row.info_meta.season.toString().replace(/^(\d)$/,'0$1')+"E"+row.info_meta.episode.toString().replace(/^(\d)$/,'0$1'); + } + data.push(row); }, //aprés toute les opération de la base diff --git a/views/channel.jade b/views/channel.jade index 2652cc0..59dd8c0 100644 --- a/views/channel.jade +++ b/views/channel.jade @@ -22,8 +22,8 @@ block content if(typeof video.info_meta !== 'undefined' && typeof video.info_meta.show !== 'undefined') | #{video.info_meta.show} td - if(typeof video.info_meta !== 'undefined' && typeof video.info_meta.season !== 'undefined' && typeof video.info_meta.episode !== 'undefined') - | S #{video.info_meta.season} E #{video.info_meta.episode} + if(typeof video.season_episode !== 'undefined') + | #{video.season_episode} td= video.second td= video.year script.