summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-22 11:10:59 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-22 11:10:59 +0200
commite3c76460529cb82a09702602bcbdc62de09b928c (patch)
treeb5bb35c4c927fba2cc5d89525db0593be11c454b
parentb9d3505d52777735f8b284e8fa95fb9954f2d64c (diff)
downloadshrinker-e3c76460529cb82a09702602bcbdc62de09b928c.tar.gz
shrinker-e3c76460529cb82a09702602bcbdc62de09b928c.zip
use csv not hex
-rw-r--r--worker.js13
1 files changed, 2 insertions, 11 deletions
diff --git a/worker.js b/worker.js
index 3fa14f1..96c3473 100644
--- a/worker.js
+++ b/worker.js
@@ -468,14 +468,6 @@ function flatten(obj) {
await ch.publish("amq.topic", "global", new Buffer("matches_update"));
}
- // based on an array of 2 by uints, convert to hex string
- function items_to_hash(items) {
- let hexstr = "";
- items.forEach((i) =>
- hexstr += ("000" + Number(i).toString(16)).slice(-4)); // pad for 2B
- return hexstr;
- }
-
// Split participant API data into participant and participant_stats
// Should not need to query db here.
function calculate_participant_stats(match, roster, participant) {
@@ -488,9 +480,8 @@ function flatten(obj) {
p_s.updated_at = new Date();
p_s.created_at = new Date(Date.parse(match.created_at));
p_s.created_at.setMinutes(p_s.created_at.getMinutes() + match.duration / 60);
- p_s.items = seq.cast(seq.fn("UNHEX",
- items_to_hash(participant.participant_items.map((i) =>
- i.item_id))), "CHAR");
+ // create CSV for items
+ p_s.items = participant.participant_items.map((i) => i.item_id.toString()).join(",");
p.created_at = match.created_at;
// mappings
// hero names additionally need to be mapped old to new names