Skip to content
Merged

0.8.1 #169

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions apps/backend/src/app/database/services/person.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ export class PersonService {

private extractSubforms(parsedResponses: Chunk[]): TcMergeSubForms[] {
return parsedResponses
.filter(chunk => chunk?.id === 'elementCodes')
.map(chunk => {
try {
const chunkContent: TcMergeResponse[] = JSON.parse(chunk.content);
Expand Down Expand Up @@ -417,7 +416,7 @@ export class PersonService {
subforms,
chunks: [
{
id: 'elementCodes',
id: parsedResponses[0]?.id || '',
type: parsedResponses[0]?.responseType || '',
ts: parsedResponses[0]?.ts || 0,
variables: Array.from(variables)
Expand Down Expand Up @@ -541,7 +540,6 @@ export class PersonService {
);
}

// Process units if they exist
if (Array.isArray(booklet.units) && booklet.units.length > 0) {
// Process units in batches to improve performance
const batchSize = 10;
Expand Down Expand Up @@ -765,14 +763,6 @@ export class PersonService {
return booklet;
}

/**
* Process logs for persons
* @param persons The persons to process logs for
* @param unitLogs The unit logs to process
* @param bookletLogs The booklet logs to process
* @param overwriteExistingLogs Whether to overwrite existing logs
* @returns A summary of the processing results
*/
async processPersonLogs(
persons: Person[],
unitLogs: any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,45 +288,59 @@ export class WorkspaceTestResultsService {
},
relations: ['responses']
});
const mappedResponses = unit.responses
.filter(response => response.subform === 'elementCodes')
.map(response => {
let value = response.value;
if (typeof value === 'string') {
if (value.startsWith('[') && value.endsWith(']')) {
try {
value = JSON.parse(value);
} catch (e) {
// If parsing fails, keep the original value
this.logger.warn(`Failed to parse JSON array: ${value}`);
}
} else if (value.startsWith('{') && value.endsWith('}')) {
try {
const jsonArrayString = value.replace(/^\{/, '[').replace(/\}$/, ']');
value = JSON.parse(jsonArrayString);
} catch (e) {
// If parsing fails, keep the original value
this.logger.warn(`Failed to parse curly brace array: ${value}`);
}

const responsesBySubform = {};

unit.responses.forEach(response => {
let value = response.value;
if (typeof value === 'string') {
if (value.startsWith('[') && value.endsWith(']')) {
try {
value = JSON.parse(value);
} catch (e) {
// If parsing fails, keep the original value
this.logger.warn(`Failed to parse JSON array: ${value}`);
}
} else if (value.startsWith('{') && value.endsWith('}')) {
try {
const jsonArrayString = value.replace(/^\{/, '[').replace(/\}$/, ']');
value = JSON.parse(jsonArrayString);
} catch (e) {
// If parsing fails, keep the original value
this.logger.warn(`Failed to parse curly brace array: ${value}`);
}
}
}

return {
id: response.variableid,
value: value,
status: response.status
};
});
const mappedResponse = {
id: response.variableid,
value: value,
status: response.status
};

const uniqueResponses = mappedResponses.filter(
(response, index, self) => index === self.findIndex(r => r.id === response.id)
);
const subformKey = response.subform || 'elementCodes';

return {
responses: [{
id: 'elementCodes',
if (!responsesBySubform[subformKey]) {
responsesBySubform[subformKey] = [];
}

responsesBySubform[subformKey].push(mappedResponse);
});

// Create responses array with unique responses for each subform
const responsesArray = Object.keys(responsesBySubform).map(subform => {
const uniqueResponses = responsesBySubform[subform].filter(
(response, index, self) => index === self.findIndex(r => r.id === response.id)
);

return {
id: subform === 'default' ? 'elementCodes' : subform,
content: uniqueResponses
}]
};
});

return {
responses: responsesArray
};
}

Expand Down Expand Up @@ -449,7 +463,6 @@ export class WorkspaceTestResultsService {
});
}


async deleteUnit(
workspaceId: number,
unitId: number
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/app/components/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[appTitle]="'Web application for coding'"
[introHtml]="'appService.appConfig.introHtml'"
[appName]="'IQB-Kodierbox'"
[appVersion]="'0.8.0'"
[appVersion]="'0.8.1'"
[userName]="authData.userName"
[userLongName]="appService.userProfile.firstName + ' ' + appService.userProfile.lastName"
[isUserLoggedIn]="Number(authData.userId) > 0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export class UnitPlayerComponent implements AfterViewInit, OnChanges, OnDestroy
}, {}
);
}

if (this.iFrameElement) {
const unitPlayerContent = unitPlayerChange?.currentValue || this.unitPlayer() || '';
this.updateIframeContent(unitPlayerContent.replace(/"/g, ''));
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coding-box",
"version": "0.8.0",
"version": "0.8.1",
"author": "IQB - Institut zur Qualitätsentwicklung im Bildungswesen",
"license": "MIT",
"scripts": {
Expand Down