Commit ece4fedb authored by Anton's avatar Anton
Browse files

Replace more old selector.value occurrences

parent b9a04396
......@@ -97,7 +97,7 @@ export default {
'annotations/get',
this.cell.sourceUuid
)
this.videoTime = DateTime.fromISO(videoAnnotation.target.selector.value, { setZone: true })
this.videoTime = DateTime.fromMillis(videoAnnotation.target.selector._valueMillis)
try {
const meta = await this.$store.dispatch('metadata/get', videoAnnotation)
if (meta && meta.title) this.videoMeta = meta
......@@ -116,7 +116,7 @@ export default {
let idx = -1, annotation = this.annotations[0]
while (annotation && idx < this.annotations.length &&
this.baseSelector > DateTime.fromISO(annotation.target.selector.value, { setZone: true })) {
this.baseSelector > DateTime.fromMillis(annotation.target.selector._valueMillis)) {
idx++
annotation = this.annotations[idx + 1]
}
......@@ -188,14 +188,14 @@ export default {
isAnnotationActive (annotation, index) {
let i = 0
while (i < this.annotations.length) {
const dt = DateTime.fromISO(this.annotations[i].target.selector.value)
const dt = DateTime.fromMillis(this.annotations[i].target.selector._valueMillis)
if (this.gridTime && this.gridTime >= dt && index === i) return true
i++
}
return false
},
formatSelectorForList (annotation) {
const annotationDate = DateTime.fromISO(annotation.target.selector.value, { setZone: true })
const annotationDate = DateTime.fromMillis(annotation.target.selector._valueMillis)
return Interval.fromDateTimes(this.videoTime, annotationDate)
.toDuration()
.toFormat(constants.config.TIMECODE_FORMAT)
......@@ -217,32 +217,19 @@ export default {
if (map) {
this.map = map
}
const selectorValue = videoAnnotation.target.selector.value
let startDate = DateTime.fromISO(selectorValue, {
setZone: true
})
if (this.cell.start) startDate = startDate.plus(this.cell.start * 1000)
let endDate
if (this.cell.duration) endDate = startDate.plus(this.cell.duration * 1000)
else endDate = startDate.plus(this.videoMeta.duration * 1000)
const endDateISO = endDate.toISO()
const
startMillis = videoAnnotation.target.selector._valueMillis + (this.cell.start ? this.cell.start * 1000 : 0),
endMillis = startMillis + (this.cell.duration || videoAnnotation.target.selector._valueDuration || 0)
const annotationsQuery = {
'target.id': videoAnnotation.target.id,
'target.type': constants.mapTypes.MAP_TYPE_TIMELINE,
'body.type': 'TextualBody',
'target.selector.value': {
$gte: startDate.toISO(),
$lte: endDateISO
'target.selector._valueMillis': {
$gte: startMillis,
$lte: endMillis
}
}
// if (!process.env.IS_VIEWER) {
// annotationsQuery['target.selector.value'] = {
// $gte: startDate.toISO(),
// $lte: endDateISO
// }
// }
// let regCheck
if (this.cell.textfilter) {
annotationsQuery['body.value'] = RegExp(`.*${this.cell.textfilter}.*`, 'ig')
......@@ -260,22 +247,14 @@ export default {
const annotationsResult = await this.$store.dispatch('annotations/find', annotationsQuery)
let annotations = annotationsResult.items.filter(a => {
return DateTime.fromISO(a.target.selector.value, { setZone: true }) >= this.videoTime
})
annotations = annotations.sort((a, b) => {
let tDiff =
Date.parse(a.target.selector.value) -
Date.parse(b.target.selector.value)
if (tDiff === 0) {
tDiff = DateTime.fromISO(b.created, { setZone: true }) - DateTime.fromISO(a.created, { setZone: true })
}
return tDiff
return DateTime.fromMillis(a.target.selector._valueMillis) >= this.videoTime
})
annotations = annotations.sort(this.$sort.onRef)
this.annotations = annotations
this.annotationTimes = []
annotations.forEach(a => {
this.annotationTimes.push(
DateTime.fromISO(a.target.selector.value, { setZone: true })
DateTime.fromMillis(a.target.selector._value)
)
})
} // TODO: else, show not found?
......
......@@ -72,7 +72,7 @@
if (video) {
this.video = video
this.videoTime = DateTime.fromISO(video.target.selector.value)
this.videoTime = DateTime.fromMillis(video.target.selector._valueMillis)
this.contextTime = this.videoTime
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment