Pull Request branch dev-clone to main #1
|
|
@ -417,8 +417,16 @@ const assessmentsRoute = new Hono<HonoEnv>()
|
||||||
.offset(page * limit)
|
.offset(page * limit)
|
||||||
.limit(limit);
|
.limit(limit);
|
||||||
|
|
||||||
|
// Format the result to return an object where questionId is the key and optionId is the value
|
||||||
|
const formattedResult = result.reduce((acc, item) => {
|
||||||
|
if (item.questionId != null && item.optionId != null) {
|
||||||
|
acc[item.questionId] = item.optionId;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {} as Record<string, string>); // Type assertion to ensure the accumulator is an object with string keys and values
|
||||||
|
|
||||||
return c.json({
|
return c.json({
|
||||||
data: result.map((d) => ({ ...d, fullCount: undefined })),
|
data: formattedResult,
|
||||||
_metadata: {
|
_metadata: {
|
||||||
currentPage: page,
|
currentPage: page,
|
||||||
totalPages: Math.ceil(
|
totalPages: Math.ceil(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user