From 192c57fa8569d13bb82d7eea0034f5b4271a8020 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 19 Feb 2016 12:16:09 +0100 Subject: [PATCH] re-add removed code for dataexport.history --- website/src/controllers/api-v2/dataexport.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/src/controllers/api-v2/dataexport.js b/website/src/controllers/api-v2/dataexport.js index ad8a998dd2..1c88d2d90f 100644 --- a/website/src/controllers/api-v2/dataexport.js +++ b/website/src/controllers/api-v2/dataexport.js @@ -22,6 +22,21 @@ var request = require('request'); ------------------------------------------------------------------------ */ +dataexport.history = function(req, res) { + var user = res.locals.user; + var output = [ + ["Task Name", "Task ID", "Task Type", "Date", "Value"] + ]; + _.each(user.tasks, function(task) { + _.each(task.history, function(history) { + output.push( + [task.text, task.id, task.type, moment(history.date).format("MM-DD-YYYY HH:mm:ss"), history.value] + ); + }); + }); + return res.csv(output); +} + var userdata = function(user) { if(user.auth && user.auth.local) { delete user.auth.local.salt;