Skip to content

Commit

Permalink
updateed placement file #52
Browse files Browse the repository at this point in the history
  • Loading branch information
a-kamel committed Apr 17, 2015
1 parent 467c5ea commit c37ce60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
1 change: 1 addition & 0 deletions DSP
Submodule DSP added at 8bfaf8
39 changes: 4 additions & 35 deletions routes/placements.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,11 @@ router.route('/')
}, function(err) {
res.writeStatus(400);
});
var adID = winningAd.id;

var price = winningAd.price;
client.search({
index: 'index',
type: 'creative',
body: {
query: {
match: {
id: adID
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
var cID = hits.get(campaignId);
client.search({
index: 'index',
type: 'campaign',
body: {
query: {
match: {
id: cID
}
}
}
}).then(function (resp) {
var hits = resp.hits.hits;
var budget = hits.get(budget);
var newBudget = budget - price ;

}, function (err) {
console.trace(err.message);
});
}, function (err) {
console.trace(err.message);
});
var budget = winningAd.budget;
var newBudget = budget - price;

(winningAd).data('budget', "newBudget");
});

Expand Down

0 comments on commit c37ce60

Please sign in to comment.