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

Internal types are not visualized #79

Open
htysc opened this issue Aug 3, 2023 · 1 comment
Open

Internal types are not visualized #79

htysc opened this issue Aug 3, 2023 · 1 comment

Comments

@htysc
Copy link
Collaborator

htysc commented Aug 3, 2023

Internal types are not listed by VisualizeService, VisualizeProgram, etc. Only characteristics and questions are listed.

if (type === 'characteristic') {
const characteristic = await fetchCharacteristic(id);
const fieldType = characteristic.fetchData.fieldType;
const isOption = typeof data === "string" && data.startsWith('http://snmi#option');
const label = <Typography>{characteristic.fetchData.label}</Typography>;
let value;
if (typeof data === "string" && data.includes('://') && !isOption) {
data = await getURILabel(data);
if (characteristic.fetchData.name === 'Gender') {
data = data.substring(data.lastIndexOf(':') + 1);
}
} else if (isOption) {
const id = data.match(/_(\d+)/)[1];
data = characteristic.fetchData.options.find(option => option._id === id).label;
}
if (fieldType === 'MultiSelectField') {
value = (await getOptionLabels(data, characteristic.fetchData.options)).map((label, idx) => {
return <Chip key={idx + label} label={label} sx={{mr: 1}}/>
});
} else if (fieldType === 'AddressField') {
value = <Typography>
{`${data.unitNumber ? data.unitNumber + '-' : ''}${data.streetNumber ? data.streetNumber : ''} ${data.streetName} ${data.streetType ? streetTypes[data.streetType] : ''}
${data.streetDirection ? streetDirections[data.streetDirection] : ''}, ${data.city}, ${states[data.state]}, ${data.postalCode}`}
</Typography>;
} else if (['DateField', 'DateTimeField', 'TimeField'].includes(fieldType)) {
value = <Typography>{new Date(data).toLocaleString()}</Typography>;
} else if (typeof data === "boolean") {
value = data ? <Typography>Yes</Typography> : <Typography>No</Typography>;
} else {
value = <Typography>{data}</Typography>;
}
information.push({
label, value, id: key
})
} else if (type === 'question') {
const question = await fetchQuestion(id);
information.push({
label: question.question.content, value, id: key
});
}

The field(s) to be displayed for each internal type (e.g. program name for Program, first+last names for Volunteer) must be determined.

@LesterLyu
Copy link
Member

You are correct, it is not implememted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants