Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankbrgowda committed Oct 30, 2023
1 parent c8bf04a commit efe19fb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,24 @@ export class DiscontinuousLocationEndChange extends FeatureChange {
logger.error(errMsg)
throw new Error(errMsg)
}
// const oldEnd = feature.discontinuousLocations[index].end
// if (oldEnd !== expectedOldEnd) {
// const errMsg = `Location's current end value ${oldEnd} doesn't match with expected value ${expectedOldEnd}`
// logger.error(errMsg)
// throw new Error(errMsg)
// }
// const { start } = feature.discontinuousLocations[index]
// if (newEnd <= start) {
// const errMsg = `location end (${newEnd}) can't be smaller than location start (${start})`
// logger.error(errMsg)
// throw new Error(errMsg)
// }
// const nextLocation = feature.discontinuousLocations[index + 1]
// if (nextLocation && newEnd >= nextLocation.start) {
// const errMsg = `Location end (${newEnd}) can't be larger than the next location's start (${nextLocation.start})`
// logger.error(errMsg)
// throw new Error(errMsg)
// }
const oldEnd = feature.discontinuousLocations[index].end
if (oldEnd !== expectedOldEnd) {
const errMsg = `Location's current end value ${oldEnd} doesn't match with expected value ${expectedOldEnd}`
logger.error(errMsg)
throw new Error(errMsg)
}
const { start } = feature.discontinuousLocations[index]
if (newEnd <= start) {
const errMsg = `location end (${newEnd}) can't be smaller than location start (${start})`
logger.error(errMsg)
throw new Error(errMsg)
}
const nextLocation = feature.discontinuousLocations[index + 1]
if (nextLocation && newEnd >= nextLocation.start) {
const errMsg = `Location end (${newEnd}) can't be larger than the next location's start (${nextLocation.start})`
logger.error(errMsg)
throw new Error(errMsg)
}
feature.discontinuousLocations[index].end = newEnd
if (index === 0) {
feature.end = newEnd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,36 +93,30 @@ export class DiscontinuousLocationStartChange extends FeatureChange {
logger.error(errMsg)
throw new Error(errMsg)
}
console.log('>>>>>>>>>>>')
console.log('>>>>>>>>>>>')
console.log('>>>>>>>>>>>')
console.log('>>>>>>>>>>>')
console.log('>>>>>>>>>>>')
// const oldStart = feature.discontinuousLocations[index].start
// if (oldStart !== expectedOldStart) {
// const errMsg = `Location's current start value ${oldStart} doesn't match with expected value ${expectedOldStart}`
// logger.error(errMsg)
// throw new Error(errMsg)
// }
// const { end } = feature.discontinuousLocations[index]
// if (newStart >= end) {
// const errMsg = `location start (${newStart}) can't be larger than location end (${end})`
// logger.error(errMsg)
// throw new Error(errMsg)
// }
// const previousLocation = feature.discontinuousLocations[index - 1]
// if (previousLocation && newStart <= previousLocation.end) {
// const errMsg = `Location start (${newStart}) can't be larger than the previous location's end (${previousLocation.end})`
// logger.error(errMsg)
// throw new Error(errMsg)
// }

const oldStart = feature.discontinuousLocations[index].start
if (oldStart !== expectedOldStart) {
const errMsg = `Location's current start value ${oldStart} doesn't match with expected value ${expectedOldStart}`
logger.error(errMsg)
throw new Error(errMsg)
}
const { end } = feature.discontinuousLocations[index]
if (newStart >= end) {
const errMsg = `location start (${newStart}) can't be larger than location end (${end})`
logger.error(errMsg)
throw new Error(errMsg)
}
const previousLocation = feature.discontinuousLocations[index - 1]
if (previousLocation && newStart <= previousLocation.end) {
const errMsg = `Location start (${newStart}) can't be larger than the previous location's end (${previousLocation.end})`
logger.error(errMsg)
throw new Error(errMsg)
}
feature.discontinuousLocations[index].start = newStart
if (index === 0) {
feature.start = newStart
}

logger.debug?.(`I'm here ${index}`)

try {
topLevelFeature.markModified('children')
await topLevelFeature.save()
Expand Down

0 comments on commit efe19fb

Please sign in to comment.