-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: master
Are you sure you want to change the base?
Conversation
785d84a
to
7462308
Compare
There was a problem hiding this 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
?
lib/src/model/json_init.dart
Outdated
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){ |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure using int
s 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"), |
There was a problem hiding this comment.
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; | |||
|
There was a problem hiding this comment.
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?
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")); |
There was a problem hiding this comment.
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?
List<String> list = []; | ||
for(Course course in courseTable.courses){ | ||
list.addAll(course.coursePeriods.map((coursePeriod) => coursePeriod.period).toList()); | ||
} | ||
return intList; | ||
return list.toSet().toList(); |
There was a problem hiding this comment.
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?
Description
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 incourse_info_page.dart
.The department name only support in Chinese since it's too long in English version.
Implementation
iplus
.Testing Instructions
Please check the course info page work correctly.
Additional Notes
Please note that it have some hard-coded rule in
getDepartment
function incourse_info_page.dart
.It may need to migrate in the future or the rule is changed.