Skip to content

teams: smoother survey exports (fixes #8674) #8675

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

Merged
merged 3 commits into from
May 21, 2025
Merged
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.18.87",
"version": "0.18.88",
"myplanet": {
"latest": "v0.25.40",
"min": "v0.24.40"
"latest": "v0.25.42",
"min": "v0.24.42"
},
"scripts": {
"ng": "ng",
Expand Down
20 changes: 11 additions & 9 deletions src/app/submissions/submissions.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Subject, of, forkJoin, throwError } from 'rxjs';
import { catchError, finalize, map, switchMap, tap } from 'rxjs/operators';
import { catchError, map, switchMap, tap } from 'rxjs/operators';
import { Chart } from 'chart.js';
import htmlToPdfmake from 'html-to-pdfmake';
import { findDocuments } from '../shared/mangoQueries';
Expand Down Expand Up @@ -364,9 +364,14 @@ export class SubmissionsService {
}),
switchMap(([ submissionsTuple, planets ]: [ [ any[], number, string[] ], any[] ]) => {
const [ submissions, time, questionTexts ] = submissionsTuple;
const filteredSubmissions = team
? submissions.filter(s => s.team === team)
: submissions;
const normalizedSubmissions = submissions.map(sub => ({
...sub,
parent: {
...sub.parent,
questions: Array.isArray(sub.parent.questions) ? sub.parent.questions : exam.questions
}
}));
const filteredSubmissions = team ? normalizedSubmissions.filter(s => s.team === team) : normalizedSubmissions;
if (!filteredSubmissions.length) {
this.dialogsLoadingService.stop();
this.planetMessageService.showMessage($localize`There is no survey response`);
Expand All @@ -380,17 +385,14 @@ export class SubmissionsService {
return forkJoin(
submissionsWithPlanetName.map(submission => {
if (submission.team) {
return this.teamsService.getTeamName(submission.team).pipe(
map(teamName => ({ ...submission, teamName }))
);
return this.teamsService.getTeamName(submission.team).pipe(map(teamName => ({ ...submission, teamName })));
}
return of(submission);
})
).pipe(map((updatedSubmissions: any[]): [ any[], number, string[] ] => [ updatedSubmissions, time, questionTexts ])
);
})
)
.subscribe(async tuple => {
).subscribe(async tuple => {
if (!tuple) {
return;
}
Expand Down
Loading