Skip to content
Permalink
Browse files

bugfix draft event and date (#760)

  • Loading branch information
lusbenjamin authored and Manuel-777 committed Nov 26, 2019
1 parent eaa5a1e commit 2cf67cbb3fb366c50dda3746757980f27b3a843f
Showing with 3 additions and 11 deletions.
  1. +3 −11 src/window_background/labels.js
@@ -93,15 +93,11 @@ function startDraft() {
}

function getDraftData(id, entry) {
const json = entry.json();
const data = playerData.draft(id) || createDraft(id, entry);

if (!data.date && json.timestamp) {
if (!data.date) {
// the first event we see we set the date.
data.timestamp = json.timestamp;
data.date = parseWotcTimeFallback(json.timestamp);
data.date = globals.logTime;
}

return data;
}

@@ -1175,7 +1171,6 @@ export function onLabelInDraftDraftStatus(entry) {
startDraft();
const {
DraftId: draftId,
EventName: eventName,
PackNumber: packNumber,
PickNumber: pickNumber,
PickedCards
@@ -1190,7 +1185,6 @@ export function onLabelInDraftDraftStatus(entry) {
currentPack: (json.DraftPack || []).slice(0)
};
data.draftId = data.id;
data.set = getDraftSet(eventName) || data.set;

setDraftData(data);
}
@@ -1201,7 +1195,6 @@ export function onLabelInDraftMakePick(entry) {
if (!json) return;
const {
DraftId: draftId,
EventName: eventName,
PackNumber: packNumber,
PickNumber: pickNumber,
PickedCards: pickedCards
@@ -1210,14 +1203,12 @@ export function onLabelInDraftMakePick(entry) {
const data = {
...getDraftData(draftId, entry),
draftId,
eventName,
packNumber,
pickNumber,
pickedCards,
currentPack: (json.DraftPack || []).slice(0)
};
data.draftId = data.id;
data.set = getDraftSet(eventName) || data.set;
setDraftData(data);
}

@@ -1247,6 +1238,7 @@ export function onLabelInEventCompleteDraft(entry) {
...getDraftData(draftId, entry),
...json
};
data.set = getDraftSet(json.InternalEventName) || data.set;
data.id = toolId;
// clear working-space draft data
clearDraftData(draftId);

0 comments on commit 2cf67cb

Please sign in to comment.
You can’t perform that action at this time.