Skip to content

Commit

Permalink
show negative timesteps as invalid in the intervention policy drilldo…
Browse files Browse the repository at this point in the history
…wn (#5279)
  • Loading branch information
mloppie authored Oct 24, 2024
1 parent 364e9ae commit 4ea38c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const props = defineProps<{
disabled?: boolean;
placeholder?: string;
autoWidth?: boolean;
invalidateNegative?: boolean;
}>();
const emit = defineEmits(['update:model-value', 'focusout']);
const inputField = ref<HTMLInputElement | null>(null);
Expand Down Expand Up @@ -63,7 +64,7 @@ const updateValue = (event: Event) => {
const value = (event.target as HTMLInputElement).value;
maskedValue.value = value;
const numValue = toNumber(value);
error.value = isNaN(numValue) ? 'Invalid number' : '';
error.value = isNaN(numValue) || (props.invalidateNegative && numValue < 0) ? 'Invalid number' : '';
};
function displayValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Starting at day
<tera-input-number
auto-width
invalidate-negative
:model-value="intervention.staticInterventions[0].timestep"
@update:model-value="(val) => onUpdateThreshold(val, 0)"
placeholder="timestep"
Expand Down
4 changes: 2 additions & 2 deletions testing/manual/intervention-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Report any issues into GitHub: [open an issue](https://github.com/DARPA-ASKEM/te
2. Edit the default intervention card, name it `Static Parameters` and leave it as _Static_.
3. Set Parameter `beta` to value `0.0001` starting at timestep `20`.
4. Click `+ Add`.
5. Set the Parameter gamma to 0.5
5. Set the Parameter gamma to `0.5`
6. Check that the charts reflect the intervention
### 5. Try to create an invalid intervention
Expand All @@ -42,7 +42,7 @@ Report any issues into GitHub: [open an issue](https://github.com/DARPA-ASKEM/te
### 7. Create a static state criteria
1. Click `+ Add intervention`
2. Name it `Static State` and leave it as _Static_.
3. Set State `I` to value `600` starting at timestep 40`.
3. Set State `I` to value `600` starting at timestep `40`.
### 8. Create a dynamic state criteria
1. Click `+ Add intervention`
Expand Down

0 comments on commit 4ea38c2

Please sign in to comment.