From aadb3da9ffab4ea49af2f5ec80885653c62bb697 Mon Sep 17 00:00:00 2001 From: Jesse Washburn <142361664+jessewashburn@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:27:28 -0500 Subject: [PATCH] teams: smoother surveys count (fixes #8110) (#8122) Co-authored-by: dogi --- package.json | 2 +- src/app/surveys/surveys.component.ts | 8 ++++++-- src/app/teams/teams-view.component.html | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a3ce535ca0..dc3b2dc4ce 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "planet", "license": "AGPL-3.0", - "version": "0.16.72", + "version": "0.16.73", "myplanet": { "latest": "v0.22.29", "min": "v0.21.29" diff --git a/src/app/surveys/surveys.component.ts b/src/app/surveys/surveys.component.ts index 5079e926d3..7e9ec3b1f6 100644 --- a/src/app/surveys/surveys.component.ts +++ b/src/app/surveys/surveys.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild, AfterViewInit, OnDestroy, Input } from '@angular/core'; +import { Component, OnInit, ViewChild, AfterViewInit, OnDestroy, Input, Output, EventEmitter } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { FormGroup } from '@angular/forms'; import { MatDialog, MatDialogRef } from '@angular/material/dialog'; @@ -34,6 +34,7 @@ export class SurveysComponent implements OnInit, AfterViewInit, OnDestroy { surveys = new MatTableDataSource(); @ViewChild(MatSort) sort: MatSort; @ViewChild(MatPaginator) paginator: MatPaginator; + @Output() surveyCount = new EventEmitter(); displayedColumns = (this.userService.doesUserHaveRole([ '_admin', 'manager' ]) ? [ 'select' ] : []).concat( [ 'name', 'taken', 'courseTitle', 'createdDate', 'action' ] ); @@ -97,7 +98,10 @@ export class SurveysComponent implements OnInit, AfterViewInit, OnDestroy { this.dialogsLoadingService.stop(); }); this.couchService.checkAuthorization(this.dbName).subscribe((isAuthorized) => this.isAuthorized = isAuthorized); - this.surveys.connect().subscribe(surveys => this.parentCount = surveys.filter(survey => survey.parent === true).length); + this.surveys.connect().subscribe(surveys => { + this.parentCount = surveys.filter(survey => survey.parent === true).length; + this.surveyCount.emit(surveys.length); + }); } ngAfterViewInit() { diff --git a/src/app/teams/teams-view.component.html b/src/app/teams/teams-view.component.html index 2fea687b5b..03c6da7a91 100644 --- a/src/app/teams/teams-view.component.html +++ b/src/app/teams/teams-view.component.html @@ -213,7 +213,10 @@

{{configuration - + + Surveys ({{surveysCount}}) + +