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

Completed "Course Student List in Course Info Page" #223

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

ntut-xuan
Copy link
Collaborator

@ntut-xuan ntut-xuan commented Feb 12, 2024

Description

Wait #221 merged into master since it's the base of this PR.

In this PR, I completed the course student list shows in course info page.

It also contains to fetch department from credit query page or timeline page, please take a look about the getDepartment function in course_info_page.dart.

The department name only support in Chinese since it's too long in English version.

Implementation

  • Fetch the department map frmo credit query page or timeline page.
  • Fetch the student list on iplus.
  • Show the student list in course info page.

Testing Instructions

Please check the course info page work correctly.

Additional Notes

Please note that it have some hard-coded rule in getDepartment function in course_info_page.dart.
It may need to migrate in the future or the rule is changed.

@ntut-xuan ntut-xuan self-assigned this Feb 12, 2024
@ntut-xuan ntut-xuan added this to the 1.6 milestone Feb 12, 2024
@James-Lu-none James-Lu-none force-pushed the course-student-list branch 2 times, most recently from 785d84a to 7462308 Compare February 19, 2024 04:11
Copy link
Member

@rileychh rileychh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't tested yet, only viewed the code.
Seems like new files are missing trailing newlines, forgot to run dart format?

static String stringInit(String value) {
return value ?? "";
}

static List<T> listInit<T>(List<T> value) {
return value ?? [] as List<T>;
static List<T> listInit<T>(List<T> value){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the white space before { accidentally deleted?


@JsonSerializable()
class Course {
late int id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure using ints to store the course IDs is sufficient to handle all cases? In other words, are we sure these IDs are always numbers and never exceed 2^31?

@@ -181,6 +184,8 @@ class MessageLookup extends MessageLookupByLibrary {
"logoutWarning":
MessageLookupByLibrary.simpleMessage("Are you sure you want to log out? \nAll data will be cleared"),
"missingRequiredInformation": MessageLookupByLibrary.simpleMessage("Missing required information"),
"name": MessageLookupByLibrary.simpleMessage("name"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this capitalized correctly?

@@ -63,8 +65,7 @@ class _ISchoolPageState extends State<ISchoolPage> with SingleTickerProviderStat
}

Widget tabPageView() {
CourseMainJson course = widget.courseInfo.main.course;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this newline accidentally removed?

Comment on lines 55 to 62
isHideSaturday = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.weekday == 6));
isHideSunday = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.weekday == 7));
isHideUnKnown = true;
isHideN = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.period == "N"));
isHideA = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.period == "A"));
isHideB = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.period == "B"));
isHideC = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.period == "C"));
isHideD = !courseTable.courses.any((course) => course.coursePeriods.any((coursePeriod) => coursePeriod.period == "D"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a helper function here to reduce repetitive code?

Comment on lines 117 to 121
List<String> list = [];
for(Course course in courseTable.courses){
list.addAll(course.coursePeriods.map((coursePeriod) => coursePeriod.period).toList());
}
return intList;
return list.toSet().toList();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to start list as a set so we don't have to convert it twice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants