From ef45e69584ce778788d95b98663adf7b2b484c1d Mon Sep 17 00:00:00 2001 From: Uriah Xuan Date: Fri, 1 Mar 2024 13:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=BE=A9=E3=80=8C=E8=AE=80=E5=8F=96?= =?UTF-8?q?=E5=AD=B8=E7=94=9F=E5=88=97=E8=A1=A8=E6=99=82=E5=87=BA=E7=8F=BE?= =?UTF-8?q?=E5=A4=A7=E9=87=8F=E5=BB=B6=E9=81=B2=E3=80=8D=E7=9A=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C=20(#231)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement: Loading Text * Fix: Loading Twice * Chore: Format --- lib/generated/intl/messages_en.dart | 2 ++ lib/generated/intl/messages_zh_TW.dart | 2 ++ lib/generated/l10n.dart | 20 +++++++++++++++++++ lib/l10n/intl_en.arb | 2 ++ lib/l10n/intl_zh_TW.arb | 2 ++ .../iplus_get_course_student_list_task.dart | 6 +++--- .../coursedetail/screen/course_info_page.dart | 11 ---------- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 18cfcaa5..60f02c7f 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -146,6 +146,8 @@ class MessageLookup extends MessageLookupByLibrary { "getScoreRankError": MessageLookupByLibrary.simpleMessage("There\'s an error getting the grades"), "getScoreRankQuestionnaireError": MessageLookupByLibrary.simpleMessage( "There\'s an error getting the grades.\nPlease check if the Online Course Evaluation Questionnaire has been completed"), + "getStudentList": MessageLookupByLibrary.simpleMessage("Getting student list..."), + "getStudentListError": MessageLookupByLibrary.simpleMessage("Getting student list error"), "github": MessageLookupByLibrary.simpleMessage("Github"), "graduationSetting": MessageLookupByLibrary.simpleMessage("Graduation credit standard setting"), "historicalDimension": MessageLookupByLibrary.simpleMessage("Historical dimension"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index b072674b..839f6481 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -141,6 +141,8 @@ class MessageLookup extends MessageLookupByLibrary { "getScoreRank": MessageLookupByLibrary.simpleMessage("取得成績中..."), "getScoreRankError": MessageLookupByLibrary.simpleMessage("取得成績錯誤"), "getScoreRankQuestionnaireError": MessageLookupByLibrary.simpleMessage("取得成績錯誤,請確認期末教學評量是否填寫完成"), + "getStudentList": MessageLookupByLibrary.simpleMessage("取得修課名單..."), + "getStudentListError": MessageLookupByLibrary.simpleMessage("取得修課名單錯誤"), "github": MessageLookupByLibrary.simpleMessage("Github"), "graduationSetting": MessageLookupByLibrary.simpleMessage("畢業學分標準設定"), "historicalDimension": MessageLookupByLibrary.simpleMessage("歷史向度"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index f7dcff55..b7bcad38 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -668,6 +668,26 @@ class S { ); } + /// `Getting student list...` + String get getStudentList { + return Intl.message( + 'Getting student list...', + name: 'getStudentList', + desc: '', + args: [], + ); + } + + /// `Getting student list error` + String get getStudentListError { + return Intl.message( + 'Getting student list error', + name: 'getStudentListError', + desc: '', + args: [], + ); + } + /// `Deleting message...` String get deleteMessage { return Intl.message( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 24ce6687..0de91936 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -62,6 +62,8 @@ "getScoreRankQuestionnaireError": "There's an error getting the grades.\nPlease check if the Online Course Evaluation Questionnaire has been completed", "getCalendar": "Getting calendar...", "getCalendarError": "Getting calendar error", + "getStudentList": "Getting student list...", + "getStudentListError": "Getting student list error", "deleteMessage": "Deleting message...", "deleteMessageError": "Delete error", "loginNTUTApp": "Login to the NTUTApp...", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index 23f1f3f1..2661478a 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -62,6 +62,8 @@ "getScoreRankQuestionnaireError": "取得成績錯誤,請確認期末教學評量是否填寫完成", "getCalendar": "取得行事曆中...", "getCalendarError": "取得行事曆錯誤", + "getStudentList": "取得修課名單...", + "getStudentListError": "取得修課名單錯誤", "deleteMessage": "刪除訊息中...", "deleteMessageError": "刪除錯誤", "loginNTUTApp": "登入北科助理...", diff --git a/lib/src/task/iplus/iplus_get_course_student_list_task.dart b/lib/src/task/iplus/iplus_get_course_student_list_task.dart index 5f70d03a..827ea063 100644 --- a/lib/src/task/iplus/iplus_get_course_student_list_task.dart +++ b/lib/src/task/iplus/iplus_get_course_student_list_task.dart @@ -12,13 +12,13 @@ import 'iplus_system_task.dart'; class IPlusGetStudentListTask extends IPlusSystemTask> { String courseId; - IPlusGetStudentListTask({required this.courseId}) : super("IPlusCourseAnnouncementTask"); + IPlusGetStudentListTask({required this.courseId}) : super("IPlusGetStudentListTask"); @override Future execute() async { final status = await super.execute(); if (status == TaskStatus.success) { - super.onStart(R.current.getISchoolPlusCourseAnnouncement); + super.onStart(R.current.getStudentList); final value = await ISchoolPlusConnector.getCourseStudent(courseId); super.onEnd(); switch (value.status) { @@ -26,7 +26,7 @@ class IPlusGetStudentListTask extends IPlusSystemTask> { result = value.result; return TaskStatus.success; case IPlusReturnStatus.fail: - return super.onError(R.current.getISchoolPlusCourseAnnouncementError); + return super.onError(R.current.getStudentListError); case IPlusReturnStatus.noPermission: final parameter = MsgDialogParameter( title: R.current.warning, diff --git a/lib/ui/pages/coursedetail/screen/course_info_page.dart b/lib/ui/pages/coursedetail/screen/course_info_page.dart index b3efe1d1..21f434e1 100644 --- a/lib/ui/pages/coursedetail/screen/course_info_page.dart +++ b/lib/ui/pages/coursedetail/screen/course_info_page.dart @@ -42,7 +42,6 @@ class _CourseInfoPageState extends State with AutomaticKeepAlive super.initState(); isLoading = true; BackButtonInterceptor.add(myInterceptor); - Future.microtask(() => _loadCourseStudent()); Future.delayed(Duration.zero, () { _addTask(); }); @@ -228,16 +227,6 @@ class _CourseInfoPageState extends State with AutomaticKeepAlive return {}; } - void _loadCourseStudent() async { - TaskFlow taskFlow = TaskFlow(); - final courseMainInfo = widget.courseInfo.main; - final task = IPlusGetStudentListTask(courseId: courseMainInfo.course.id); - taskFlow.addTask(task); - if (await taskFlow.start()) { - task.result; - } - } - String getDepartment(Map departmentMap, String studentId) { /* * Since we don't have official data to describe the following hard-coded rule is correct.