assets/scripts.js: Tweak precondition debug log

This commit is contained in:
Vladimir Panteleev 2019-07-28 08:35:58 +00:00
parent 3fbed6886b
commit 4260f0ccf4

View file

@ -43,7 +43,7 @@ function evalPrecondition(precondition, text) {
if (precondition) { if (precondition) {
let cond = preconditionToJS(precondition); let cond = preconditionToJS(precondition);
let match = eval(cond); let match = eval(cond);
console.log(text, ':', cond, '==', match); console.log('precondition', text, ':', cond, '==', match);
return match; return match;
} }
@ -99,8 +99,9 @@ function getMoments(segmentId, ms) {
let moments = momentsBySegment[segmentId] || []; let moments = momentsBySegment[segmentId] || [];
for (let i = 0; i < moments.length; i++) { for (let i = 0; i < moments.length; i++) {
let m = moments[i]; let m = moments[i];
if (ms >= m.startMs && ms < m.endMs && evalPrecondition(m.precondition)) { let momentId = segmentId + '/' + i;
result[segmentId + '/' + i] = m; if (ms >= m.startMs && ms < m.endMs && evalPrecondition(m.precondition, 'moment ' + momentId)) {
result[momentId] = m;
} }
} }
return result; return result;