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

mrc-2797 Remove calibration plot when user changes calibration options #630

Merged
merged 5 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.md
@@ -1,3 +1,7 @@
# hint 1.73.2

* Remove calibration plot when user changes calibration options

# hint 1.73.1

* fix issues with displaying Input Time Series for DRC data
Expand Down
26 changes: 12 additions & 14 deletions src/app/static/src/app/components/modelCalibrate/ModelCalibrate.vue
Expand Up @@ -44,7 +44,7 @@
<span v-translate="'genCalibResults'"></span>
</div>
<calibration-results
v-if="calibrationPlotGenerated"
v-if="calibrationPlotGenerated && complete"
></calibration-results>
</div>
</template>
Expand All @@ -62,13 +62,11 @@

import {
mapActionByName,
mapGetterByName,
mapMutationByName,
mapStateProp,
mapStateProps,
} from "../../utils";
import { ModelCalibrateMutation } from "../../store/modelCalibrate/mutations";
import { StepDescription } from "../../store/stepper/stepper";
import { RootState } from "../../root";
import { Language } from "../../store/translations/locales";
import { ModelCalibrateState } from "../../store/modelCalibrate/modelCalibrate";
Expand Down Expand Up @@ -113,18 +111,18 @@
},
computed: {
...mapStateProps<ModelCalibrateState, keyof Computed>(namespace, {
loading: (s) => s.fetching,
calibrating: (s) => s.calibrating,
generatingCalibrationPlot: (s) => s.generatingCalibrationPlot,
calibrationPlotGenerated: (s) => !!s.calibratePlotResult,
error: (s) => s.error,
progressMessage: (s) => {
loading: (state) => state.fetching,
calibrating: (state) => state.calibrating,
generatingCalibrationPlot: (state) => state.generatingCalibrationPlot,
calibrationPlotGenerated: (state) => !!state.calibratePlotResult,
error: (state) => state.error,
progressMessage: (state) => {
if (
s.status &&
s.status.progress &&
s.status.progress.length > 0
state.status &&
state.status.progress &&
state.status.progress.length > 0
) {
const p = s.status.progress[0]; //This may be either a string or ProgressPhase
const p = state.status.progress[0]; //This may be either a string or ProgressPhase
return typeof p == "string"
? p
: `${p.name}: ${p.helpText}`;
Expand Down Expand Up @@ -179,6 +177,6 @@
},
mounted() {
this.fetchOptions();
},
}
});
</script>
2 changes: 1 addition & 1 deletion src/app/static/src/app/hintVersion.ts
@@ -1 +1 @@
export const currentHintVersion = "1.73.1";
export const currentHintVersion = "1.73.2";
@@ -1,8 +1,8 @@
import Vuex, {ActionTree, MutationTree, Store} from "vuex";
import Vuex, {Store} from "vuex";
import {mockError, mockModelCalibrateState, mockRootState} from "../../mocks";
import registerTranslations from "../../../app/store/translations/registerTranslations";
import {RootState} from "../../../app/root";
import {ModelCalibrateState} from "../../../app/store/modelCalibrate/modelCalibrate";;
import {ModelCalibrateState} from "../../../app/store/modelCalibrate/modelCalibrate";
import {mount, shallowMount} from "@vue/test-utils";
import ModelCalibrate from "../../../app/components/modelCalibrate/ModelCalibrate.vue";
import CalibrationResults from "../../../app/components/modelCalibrate/CalibrationResults.vue";
Expand Down Expand Up @@ -74,7 +74,7 @@ describe("Model calibrate component", () => {
it("invokes fetch options action on mount", () => {
const mockFetch = jest.fn();
const store = getStore({}, mockFetch);
const wrapper = getWrapper(store);
getWrapper(store);
expect(mockFetch.mock.calls.length).toBe(1);
});

Expand Down Expand Up @@ -176,11 +176,17 @@ describe("Model calibrate component", () => {
"Générer des résultats d'étalonnage", "Gerando resultados de calibração", store);
});

it("renders calibration plot", () => {
it("renders calibration plot if calibration is complete", () => {
const store = getStore({complete: true, calibratePlotResult: {}});
const wrapper = getWrapper(store);
expect(wrapper.find(CalibrationResults).exists()).toBe(true);
expectTranslated(wrapper.find("#reviewResults"), "(Review results below)",
"(Consultez les résultats ci-dessous)", "(Analise os resultados abaixo)", store);
});

it("it does not render calibration plot if calibration is incomplete", () => {
const store = getStore({complete: false, calibratePlotResult: {}});
const wrapper = getWrapper(store);
expect(wrapper.find(CalibrationResults).exists()).toBe(false);
});
});