Skip to content
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

修復「讀取學生列表時出現大量延遲」的問題 #231

Merged
merged 3 commits into from
Mar 1, 2024
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
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_zh_TW.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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("歷史向度"),
Expand Down
20 changes: 20 additions & 0 deletions lib/generated/l10n.dart

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

2 changes: 2 additions & 0 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -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...",
Expand Down
2 changes: 2 additions & 0 deletions lib/l10n/intl_zh_TW.arb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
"getScoreRankQuestionnaireError": "取得成績錯誤,請確認期末教學評量是否填寫完成",
"getCalendar": "取得行事曆中...",
"getCalendarError": "取得行事曆錯誤",
"getStudentList": "取得修課名單...",
"getStudentListError": "取得修課名單錯誤",
"deleteMessage": "刪除訊息中...",
"deleteMessageError": "刪除錯誤",
"loginNTUTApp": "登入北科助理...",
Expand Down
6 changes: 3 additions & 3 deletions lib/src/task/iplus/iplus_get_course_student_list_task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ import 'iplus_system_task.dart';
class IPlusGetStudentListTask extends IPlusSystemTask<List<CourseStudent>> {
String courseId;

IPlusGetStudentListTask({required this.courseId}) : super("IPlusCourseAnnouncementTask");
IPlusGetStudentListTask({required this.courseId}) : super("IPlusGetStudentListTask");

@override
Future<TaskStatus> 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) {
case IPlusReturnStatus.success:
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,
Expand Down
11 changes: 0 additions & 11 deletions lib/ui/pages/coursedetail/screen/course_info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class _CourseInfoPageState extends State<CourseInfoPage> with AutomaticKeepAlive
super.initState();
isLoading = true;
BackButtonInterceptor.add(myInterceptor);
Future.microtask(() => _loadCourseStudent());
Future.delayed(Duration.zero, () {
_addTask();
});
Expand Down Expand Up @@ -228,16 +227,6 @@ class _CourseInfoPageState extends State<CourseInfoPage> with AutomaticKeepAlive
return <String, String>{};
}

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<String, String> departmentMap, String studentId) {
/*
* Since we don't have official data to describe the following hard-coded rule is correct.
Expand Down
Loading