Skip to content

Commit d3607d5

Browse files
added module to checkConfig
1 parent 8dcb9c4 commit d3607d5

File tree

9 files changed

+64
-26
lines changed

9 files changed

+64
-26
lines changed

builder-api/src/main/java/org/acme/model/domain/CheckConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class CheckConfig {
1111
private String checkId;
1212
private String checkName;
1313
private String checkVersion;
14+
private String checkModule;
1415
private Map<String, Object> parameters;
1516
// evaluation endpoint url for library checks
1617
private String evaluationUrl;
@@ -72,4 +73,12 @@ public String getCheckVersion() {
7273
public void setCheckVersion(String checkVersion) {
7374
this.checkVersion = checkVersion;
7475
}
76+
77+
public String getCheckModule() {
78+
return checkModule;
79+
}
80+
81+
public void setCheckModule(String checkModule) {
82+
this.checkModule = checkModule;
83+
}
7584
}

builder-frontend/src/components/homeScreen/eligibilityCheckList/eligibilityCheckDetail/ParametersConfiguration.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const ParametersConfiguration = ({
5151
<Show
5252
when={
5353
eligibilityCheck() &&
54+
eligibilityCheck().parameterDefinitions &&
5455
eligibilityCheck().parameterDefinitions.length > 0
5556
}
5657
fallback={<p>No parameters defined.</p>}

builder-frontend/src/components/homeScreen/eligibilityCheckList/eligibilityCheckDetail/PublishCheck.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,35 @@ const PublishCheck = ({
2121
if (!checks) return [];
2222
return checks
2323
.slice()
24-
.sort((check1, check2) => check2.version - check1.version);
24+
.sort((check1, check2) =>
25+
reverseCompareVersions(check1.version, check2.version)
26+
);
2527
};
2628

29+
// Called reverse compare because we are sorting the largest version number first
30+
function reverseCompareVersions(a: string, b: string): number {
31+
const aValues = normalize(a);
32+
const bValues = normalize(b);
33+
34+
for (let i = 0; i < 3; i++) {
35+
if (aValues[i] !== bValues[i]) {
36+
// The order of this subtraction is what reverses the sort order
37+
return bValues[i] - aValues[i];
38+
}
39+
}
40+
return 0;
41+
}
42+
43+
function normalize(version: string): [number, number, number] {
44+
const parts = version.split(".").map(Number);
45+
46+
while (parts.length < 3) {
47+
parts.push(0);
48+
}
49+
50+
return [parts[0], parts[1], parts[2]];
51+
}
52+
2753
return (
2854
<div class="p-12">
2955
<div class="text-3xl font-bold tracking-wide mb-2">

builder-frontend/src/components/homeScreen/eligibilityCheckList/eligibilityCheckDetail/checkTesting/EligibilityCheckTest.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const EligibilityCheckTest = ({
2929
checkId: eligibilityCheck().id,
3030
checkName: eligibilityCheck().name,
3131
checkVersion: eligibilityCheck().version,
32+
checkModule: eligibilityCheck().module,
3233
checkDescription: eligibilityCheck().description,
3334
parameterDefinitions: eligibilityCheck().parameterDefinitions,
3435
inputDefinition: eligibilityCheck().inputDefinition,

builder-frontend/src/components/project/manageBenefits/configureBenefit/EligibilityCheckListView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const EligibilityCheckListView = ({
5757
checkId: check.id,
5858
checkName: check.name,
5959
checkVersion: check.version,
60+
checkModule: check.module,
6061
checkDescription: check.description,
6162
evaluationUrl: check.evaluationUrl,
6263
parameters: {},

builder-frontend/src/components/project/manageBenefits/configureBenefit/SelectedEligibilityCheck.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,30 @@ const SelectedEligibilityCheck = ({
6363
{
6464
// Place to display information about expected inputs for check
6565
}
66-
{checkConfig().parameterDefinitions.length > 0 && (
67-
<div class="[&:has(+div)]:mb-2">
68-
<div class="text-lg font-bold pl-2">Parameters</div>
69-
<For each={checkConfig().parameterDefinitions}>
70-
{(parameter: ParameterDefinition) => {
71-
const getLabel = () => {
72-
let value = checkConfig().parameters[parameter.key];
73-
return value !== undefined ? (
74-
value.toString()
75-
) : (
76-
<span class="text-yellow-700">Not configured</span>
66+
{checkConfig().parameterDefinitions &&
67+
checkConfig().parameterDefinitions.length > 0 && (
68+
<div class="[&:has(+div)]:mb-2">
69+
<div class="text-lg font-bold pl-2">Parameters</div>
70+
<For each={checkConfig().parameterDefinitions}>
71+
{(parameter: ParameterDefinition) => {
72+
const getLabel = () => {
73+
let value = checkConfig().parameters[parameter.key];
74+
return value !== undefined ? (
75+
value.toString()
76+
) : (
77+
<span class="text-yellow-700">Not configured</span>
78+
);
79+
};
80+
return (
81+
<div class="flex gap-2 pl-4">
82+
<div>{titleCase(parameter.key)}:</div>
83+
<div>{getLabel()}</div>
84+
</div>
7785
);
78-
};
79-
return (
80-
<div class="flex gap-2 pl-4">
81-
<div>{titleCase(parameter.key)}:</div>
82-
<div>{getLabel()}</div>
83-
</div>
84-
);
85-
}}
86-
</For>
87-
</div>
88-
)}
86+
}}
87+
</For>
88+
</div>
89+
)}
8990
{unfilledRequiredParameters().length > 0 && (
9091
<div class="mt-2 text-yellow-700 font-bold">
9192
Warning: This check has required parameter(s) that are not

builder-frontend/src/components/project/manageBenefits/configureBenefit/benefitResource.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ const createScreenerBenefits = (
6262
// Actions
6363
const addCheck = (newCheck: CheckConfig) => {
6464
if (!benefit) return;
65-
console.log("updating benefit");
6665
const updatedChecks: CheckConfig[] = [...benefit.checks, newCheck];
67-
console.log("checks after upate");
68-
console.log(updatedChecks);
6966
const updatedBenefit: Benefit = { ...benefit, checks: updatedChecks };
7067
updateBenefit(updatedBenefit);
7168
};

builder-frontend/src/components/project/manageBenefits/configureBenefit/modals/ConfigureCheckModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const ConfigureCheckModal = ({
2626
checkId: checkConfig().checkId,
2727
checkName: checkConfig().checkName,
2828
checkVersion: checkConfig().checkVersion,
29+
checkModule: checkConfig().checkModule,
2930
checkDescription: checkConfig().checkDescription,
3031
evaluationUrl: checkConfig().evaluationUrl,
3132
parameterDefinitions: checkConfig().parameterDefinitions,

builder-frontend/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface CheckConfig {
2020
checkId: string;
2121
checkName: string;
2222
checkVersion: string;
23+
checkModule: string;
2324
checkDescription: string;
2425
// API endpoint for evaluating check (only for library checks)
2526
evaluationUrl?: string;

0 commit comments

Comments
 (0)