Commit ece4fedb authored by Anton's avatar Anton
Browse files

Replace more old selector.value occurrences

parent b9a04396
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
'annotations/get', 'annotations/get',
this.cell.sourceUuid this.cell.sourceUuid
) )
this.videoTime = DateTime.fromISO(videoAnnotation.target.selector.value, { setZone: true }) this.videoTime = DateTime.fromMillis(videoAnnotation.target.selector._valueMillis)
try { try {
const meta = await this.$store.dispatch('metadata/get', videoAnnotation) const meta = await this.$store.dispatch('metadata/get', videoAnnotation)
if (meta && meta.title) this.videoMeta = meta if (meta && meta.title) this.videoMeta = meta
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
let idx = -1, annotation = this.annotations[0] let idx = -1, annotation = this.annotations[0]
while (annotation && idx < this.annotations.length && 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++ idx++
annotation = this.annotations[idx + 1] annotation = this.annotations[idx + 1]
} }
...@@ -188,14 +188,14 @@ export default { ...@@ -188,14 +188,14 @@ export default {
isAnnotationActive (annotation, index) { isAnnotationActive (annotation, index) {
let i = 0 let i = 0
while (i < this.annotations.length) { 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 if (this.gridTime && this.gridTime >= dt && index === i) return true
i++ i++
} }
return false return false
}, },
formatSelectorForList (annotation) { 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) return Interval.fromDateTimes(this.videoTime, annotationDate)
.toDuration() .toDuration()
.toFormat(constants.config.TIMECODE_FORMAT) .toFormat(constants.config.TIMECODE_FORMAT)
...@@ -217,32 +217,19 @@ export default { ...@@ -217,32 +217,19 @@ export default {
if (map) { if (map) {
this.map = map this.map = map
} }
const selectorValue = videoAnnotation.target.selector.value const
let startDate = DateTime.fromISO(selectorValue, { startMillis = videoAnnotation.target.selector._valueMillis + (this.cell.start ? this.cell.start * 1000 : 0),
setZone: true endMillis = startMillis + (this.cell.duration || videoAnnotation.target.selector._valueDuration || 0)
})
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 annotationsQuery = { const annotationsQuery = {
'target.id': videoAnnotation.target.id, 'target.id': videoAnnotation.target.id,
'target.type': constants.mapTypes.MAP_TYPE_TIMELINE, 'target.type': constants.mapTypes.MAP_TYPE_TIMELINE,
'body.type': 'TextualBody', 'body.type': 'TextualBody',
'target.selector.value': { 'target.selector._valueMillis': {
$gte: startDate.toISO(), $gte: startMillis,
$lte: endDateISO $lte: endMillis
} }
} }
// if (!process.env.IS_VIEWER) {
// annotationsQuery['target.selector.value'] = {
// $gte: startDate.toISO(),
// $lte: endDateISO
// }
// }
// let regCheck // let regCheck
if (this.cell.textfilter) { if (this.cell.textfilter) {
annotationsQuery['body.value'] = RegExp(`.*${this.cell.textfilter}.*`, 'ig') annotationsQuery['body.value'] = RegExp(`.*${this.cell.textfilter}.*`, 'ig')
...@@ -260,22 +247,14 @@ export default { ...@@ -260,22 +247,14 @@ export default {
const annotationsResult = await this.$store.dispatch('annotations/find', annotationsQuery) const annotationsResult = await this.$store.dispatch('annotations/find', annotationsQuery)
let annotations = annotationsResult.items.filter(a => { let annotations = annotationsResult.items.filter(a => {
return DateTime.fromISO(a.target.selector.value, { setZone: true }) >= this.videoTime return DateTime.fromMillis(a.target.selector._valueMillis) >= 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
}) })
annotations = annotations.sort(this.$sort.onRef)
this.annotations = annotations this.annotations = annotations
this.annotationTimes = [] this.annotationTimes = []
annotations.forEach(a => { annotations.forEach(a => {
this.annotationTimes.push( this.annotationTimes.push(
DateTime.fromISO(a.target.selector.value, { setZone: true }) DateTime.fromMillis(a.target.selector._value)
) )
}) })
} // TODO: else, show not found? } // TODO: else, show not found?
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
if (video) { if (video) {
this.video = video this.video = video
this.videoTime = DateTime.fromISO(video.target.selector.value) this.videoTime = DateTime.fromMillis(video.target.selector._valueMillis)
this.contextTime = this.videoTime 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