Skip to content

Commit

Permalink
Fix: Handling of handlebars
Browse files Browse the repository at this point in the history
  • Loading branch information
zoernert committed Mar 1, 2024
1 parent f9bc633 commit 032243d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion framework/services/httppull.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module.exports = {
const Handlebars = require('handlebars');

function convertObject(obj, rulesTemplate) {
const template = Handlebars.compile(rulesTemplate);
const template = Handlebars.compile(JSON.stringify(rulesTemplate));
const context = { json: obj };
const convertedData = JSON.parse(template(context));
return convertedData;
Expand All @@ -103,6 +103,8 @@ module.exports = {
let json = await ctx.call("httppull.process",{requestId:results[0].requestId});
if(json !== null) {
json.meterId = results[0].meterId;
json.reading *= 1;
json.timestamp *= 1000; //TODO: Fix should be done in Template not in code
return await ctx.call("metering.updateReading",json);
} else return {};
}
Expand Down
2 changes: 1 addition & 1 deletion framework/services/httppull_model.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
* Settings
*/
settings: {
fields: ["_id", "fetch","processor"],
fields: ["_id", "requestId","fetch","processor","meterId"],
},

/**
Expand Down

0 comments on commit 032243d

Please sign in to comment.