-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.js
43 lines (32 loc) · 970 Bytes
/
actions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var fileData = require('./docs/actions.json');
exports.getDelta = function(lastUpdateDate){
var returnActions = [];
if (fileData != undefined)
{
var acts = fileData.actions;
acts.forEach(function(obj){
if (isLater(obj.lastChanged, lastUpdateDate))
{
returnActions.push({ actionId: obj.actionId});
}
});
}
return returnActions;
}
function isLater(date1, date2) {
return new Date(date1) > new Date(date2);
}
exports.getAction = function (id) {
var _ = require("underscore");
var returnAction = [];
//var fileData = fs.readFile("./docs/actions.json", "utf8");
console.log("id----" + id);
console.log(fileData);
if (fileData != undefined) {
//var data = JSON.parse(fileData);
var jsonid = '"' + id + '"';
returnAction = _.find(fileData.actions,{actionId:id});
console.log("return action" + returnAction);
}
return returnAction;
}