Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show negative timesteps as invalid in the intervention policy drilldown #5279

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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