Skip to content

Commit

Permalink
Merge branch 'OCD-2838' of https://github.com/andlar/chpl-website int…
Browse files Browse the repository at this point in the history
…o OCD-2838
  • Loading branch information
mattystank committed Feb 27, 2024
2 parents 66d1aaf + c2db9ae commit 35b60cc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ const validationSchema = yup.object({
.required('Field is required'),
});

const getAgeSortValue = (ageRange) => {
if (ageRange.name.length === 3) {
const getAgeSortValue = (age) => {
if (age.name.length === 3) {
return 0;
} if (ageRange.name.length === 4) {
} if (age.name.length === 4) {
return 10;
}
return parseInt(ageRange.name.charAt(0), 10);
return parseInt(age.name.charAt(0), 10);
};

function ChplSedParticipantAdd({ dispatch }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,52 +151,54 @@ function ChplSedParticipantsEdit({ task: initialTask }) {
className={classes.accordionDetails}
id={`task-participants-id-${task.id}-details`}
>
<Table size="small">
<TableHead>
<TableRow>
<TableCell>Occupation</TableCell>
<TableCell style={{ minWidth: 200 }}>Education Type</TableCell>
<TableCell>Product Experience (Months)</TableCell>
<TableCell>Professional Experience (Months)</TableCell>
<TableCell>Computer Experience (Months)</TableCell>
<TableCell>Age (Years)</TableCell>
<TableCell>Gender</TableCell>
<TableCell>Assistive Technology Needs</TableCell>
<TableCell>Actions</TableCell>
</TableRow>
</TableHead>
<TableBody size="small">
{allParticipants
.map((participant) => (
<TableRow key={participant.id ?? participant.uniqueId}>
<TableCell size="small">{ participant.occupation }</TableCell>
<TableCell style={{ minWidth: 200 }}>{ participant.educationTypeName }</TableCell>
<TableCell size="small">{ participant.productExperienceMonths }</TableCell>
<TableCell size="small">{ participant.professionalExperienceMonths }</TableCell>
<TableCell size="small">{ participant.computerExperienceMonths }</TableCell>
<TableCell size="small">{ participant.ageRange }</TableCell>
<TableCell size="small">{ participant.gender }</TableCell>
<TableCell size="small">{ participant.assistiveTechnologyNeeds }</TableCell>
<TableCell size="small">
{ task.testParticipants.some((p) => p.id === participant.id)
? (
<IconButton
onClick={() => remove(participant)}
>
<RemoveCircleOutline color="error" />
</IconButton>
) : (
<IconButton
onClick={() => add(participant)}
>
<AddIcon color="primary" />
</IconButton>
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
<>
<Table size='small'>
<TableHead>
<TableRow>
<TableCell>Occupation</TableCell>
<TableCell>Education Type</TableCell>
<TableCell>Product Experience (Months)</TableCell>
<TableCell>Professional Experience (Months)</TableCell>
<TableCell>Computer Experience (Months)</TableCell>
<TableCell>Age (Years)</TableCell>
<TableCell>Gender</TableCell>
<TableCell>Assistive Technology Needs</TableCell>
<TableCell>Actions</TableCell>
</TableRow>
</TableHead>
<TableBody>
{allParticipants
.map((participant) => (
<TableRow key={participant.id ?? participant.uniqueId}>
<TableCell size='small'>{ participant.occupation }</TableCell>
<TableCell size='small'>{ participant.educationType.name }</TableCell>
<TableCell size='small'>{ participant.productExperienceMonths }</TableCell>
<TableCell size='small'>{ participant.professionalExperienceMonths }</TableCell>
<TableCell size='small'>{ participant.computerExperienceMonths }</TableCell>
<TableCell size='small'>{ participant.age.name }</TableCell>
<TableCell size='small'>{ participant.gender }</TableCell>
<TableCell size='small'>{ participant.assistiveTechnologyNeeds }</TableCell>
<TableCell size='small'>
{ task.testParticipants.some((p) => (p.id ? (p.id === participant.id) : (p.uniqueId === participant.uniqueId)))
? (
<Button
onClick={() => remove(participant)}
>
Remove
</Button>
) : (
<Button
onClick={() => add(participant)}
>
Add
</Button>
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</>
</AccordionDetails>
<>
{ !addingParticipant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function ChplSedTaskAdd({ dispatch }) {
taskPathDeviationOptimal: formik.values.taskPathDeviationOptimal,
criteria: availableCriteria.filter((cc) => criteria.has(cc.criterion.number))
.map((cr) => cr.criterion),
participants: [],
testParticipants: [],
};
setListing({
...listing,
Expand Down

0 comments on commit 35b60cc

Please sign in to comment.