order sanity checks

This commit is contained in:
tim
2025-03-16 21:15:00 -04:00
parent b9975cda10
commit 5876efe29f
11 changed files with 130 additions and 33 deletions

View File

@@ -101,7 +101,9 @@ import {computed, ref} from "vue";
import {allocationText, DLine} from "@/charts/shape.js";
import {vectorEquals, vectorInterpolate} from "@/vector.js";
import AbsoluteTimeEntry from "@/components/AbsoluteTimeEntry.vue";
import {useStore} from "@/store/store.js";
const s = useStore()
const co = useChartOrderStore()
const props = defineProps(['order', 'builder'])
const emit = defineEmits(['update:builder'])
@@ -132,6 +134,7 @@ function buildTranches() {
const order = props.order
const builder = props.builder
const tranches = []
const warnings = []
console.log('buildTranches', builder, order, _endpoints.value)
const la = _endpoints.value[0] // use the flatline format which is a vector of length 4, useful for vectorInterpolate()
@@ -149,6 +152,9 @@ function buildTranches() {
t.startTime = reversed ? line[2] : line[0]
if (reversed ? !el : !er)
t.endTime = reversed ? line[0] : line[2]
if (t.endTime <= s.clock)
warnings.push(`Tranche already expired at ${new Date(t.endTime*1000)}`)
// console.log('tranche start/end',
// t.startTime === DISTANT_PAST ? 'PAST' : t.startTime,
// t.endTime === DISTANT_FUTURE ? 'FUTURE' : t.endTime)
@@ -157,7 +163,7 @@ function buildTranches() {
}
// if( flipped.value )
// tranches.reverse()
return tranches
return {tranches, warnings}
}