|
|
@@ -8,6 +8,7 @@ import { Observable, of, Subject, throwError } from 'rxjs';
|
|
|
import { CourseCenterPageComponent } from '../features/course-center/course-center-page.component';
|
|
|
import { AppointmentPageComponent } from '../features/appointment/appointment-page.component';
|
|
|
import { LearningPageComponent } from '../features/learning/learning-page.component';
|
|
|
+import { HomePageComponent } from '../features/home/home-page.component';
|
|
|
import { routes } from '../app.routes';
|
|
|
import { ApiService } from './api.service';
|
|
|
import { ApiEnvelope, AppUser } from './models';
|
|
|
@@ -741,6 +742,38 @@ describe('home learning modules', () => {
|
|
|
harness.fixture.detectChanges();
|
|
|
});
|
|
|
|
|
|
+ it('matches coach review tasks to student names by ID when task name fields are blank', async () => {
|
|
|
+ user.set({ userId: 300, userName: 'coach', honeyName: '张老师', groupId: 3 });
|
|
|
+ session.groupId.set(3);
|
|
|
+ const api = TestBed.inject(ApiService) as unknown as LearningModulesApiService;
|
|
|
+ const response = new Subject<ApiEnvelope<unknown>>();
|
|
|
+ api.reviewPageResponse = response;
|
|
|
+ const harness = await RouterTestingHarness.create();
|
|
|
+ await harness.navigateByUrl('/pages/home/index');
|
|
|
+ response.next({ retcode: 1, result: {
|
|
|
+ items: [
|
|
|
+ { GeneralID: 102, yhid: 100, honeyName: '', Title: '旧姓名@复习', kywsj: '2025-07-19', fxzt: 0, xxjlid: 900 },
|
|
|
+ { GeneralID: 103, yhid: '101', honeyName: ' ', HoneyName: '', kywsj: '2025-07-15', fxzt: 0, xxjlid: 901 },
|
|
|
+ ],
|
|
|
+ students: [{ id: '101', name: '李同学', taskCount: 1 }, { id: '100', name: '张雅茜', taskCount: 1 }],
|
|
|
+ page: { itemCount: 2, pageCount: 1 },
|
|
|
+ summary: { total: 2, completed: 0, due: 2, today: 0, income: 0 }, dates: [],
|
|
|
+ } });
|
|
|
+ response.complete();
|
|
|
+ api.reviewPageResponse = null;
|
|
|
+ harness.fixture.detectChanges();
|
|
|
+ const names = Array.from(harness.routeNativeElement?.querySelectorAll('.coach-memory-copy strong') ?? []).map((node) => node.textContent);
|
|
|
+ expect(names).toEqual(['张雅茜', '李同学']);
|
|
|
+ const home = harness.fixture.debugElement.query(By.directive(HomePageComponent)).componentInstance as HomePageComponent;
|
|
|
+ expect(home.coachReviewStudent({ yhid: 102, honeyName: '', HoneyName: ' ', Title: '王同学@复习' })).toBe('王同学');
|
|
|
+ expect(home.coachReviewStudent({ yhid: 103, honeyName: '', Title: ' ' })).toBe('学员 103');
|
|
|
+ expect(home.coachReviewStudent({ honeyName: '' })).toBe('未关联学员');
|
|
|
+ (harness.routeNativeElement?.querySelectorAll('.coach-memory-list article > button')[1] as HTMLButtonElement).click();
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ expect(session.student()).toEqual(jasmine.objectContaining({ userId: 101, honeyName: '李同学' }));
|
|
|
+ expect(TestBed.inject(Router).url).toContain('/pages/stu/record?id=901&gid=103');
|
|
|
+ });
|
|
|
+
|
|
|
it('keeps the complete point-reading flow available to coaches', async () => {
|
|
|
user.set({ userId: 300, userName: 'coach', honeyName: '张老师', groupId: 3 });
|
|
|
session.groupId.set(3);
|