From c5fc1869179ca71e71aea5ba0a17f77aebffd4cf Mon Sep 17 00:00:00 2001 From: nano71 <80870408+nano71@users.noreply.github.com> Date: Sat, 8 Feb 2025 16:54:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=BB=A9=E7=82=B9=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/local.properties | 4 +-- lib/common/get.dart | 2 +- lib/data.dart | 75 +++------------------------------------ lib/pages/queryScore.dart | 43 +++++++++------------- pubspec.yaml | 2 +- 5 files changed, 25 insertions(+), 101 deletions(-) diff --git a/android/local.properties b/android/local.properties index 8331262..08a0e72 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=C:\\sdk\\android-sdk flutter.sdk=C:\\sdk\\flutter flutter.buildMode=release -flutter.versionName=1.6.241225 -flutter.versionCode=75 \ No newline at end of file +flutter.versionName=1.6.250208 +flutter.versionCode=76 \ No newline at end of file diff --git a/lib/common/get.dart b/lib/common/get.dart index cf98c19..bae53d6 100644 --- a/lib/common/get.dart +++ b/lib/common/get.dart @@ -445,7 +445,7 @@ Future getScore() async { List scoreRows = []; for (int i = 1; i < dataList.length; i++) { List elementColumns = []; - for (int j in [0, 1, 3, 4, 5, 7, 6]) { + for (int j in [0, 1, 3, 4, 5, 7, 6, 11]) { elementColumns.add(parseData(i, j)); } scoreRows.add(elementColumns); diff --git a/lib/data.dart b/lib/data.dart index e311c75..44a386f 100644 --- a/lib/data.dart +++ b/lib/data.dart @@ -150,75 +150,8 @@ final List> endTimeListRestore = const [ [21, 40] ]; -final List excludedCourses = [ - "职业发展与就业指导(一)", - "职业发展与就业指导(二)", - "职业发展与就业指导(三)", - "职业发展与就业指导(四)", - "职业发展与就业指导(五)", - "就业指导与创业基础(一)", - "就业指导与创业基础(二)", - "就业指导与创业基础(三)", - "创业基础(一)", - "创业基础(二)", - "创业基础(三)", - "大学生心理健康(一)", - "大学生心理健康(二)", - "形势与政策(一)", - "形势与政策(二)", - "形势与政策(三)", - "形势与政策(四)", - "形势与政策(五)", - "形势与政策(六)", - "形势与政策(七)", - "形势与政策(八)", - "形势与政策", - "体育(一)", - "体育(二)", - "体育(三)", - "体育(四)", - "大学生安全教育(十)", - "大学生安全教育(一)", - "大学生安全教育(二)", - "大学生安全教育(三)", - "大学生安全教育(四)", - "大学生安全教育(五)", - "大学生安全教育(六)", - "大学生安全教育(七)", - "大学生安全教育(八)", - "大学生安全教育(九)", - "职业发展与就业指导(一)", - "职业发展与就业指导(二)", - "职业发展与就业指导(三)", - "职业发展与就业指导(四)", - "职业发展与就业指导(五)", - "就业指导与创业基础(一)", - "就业指导与创业基础(二)", - "就业指导与创业基础(三)", - "创业基础(一)", - "创业基础(二)", - "大学生心理学(一)", - "大学生心理学(二)", - "大学生心理健康教育(一)", - "大学生心理健康教育(二)", - "形势与政策(一)", - "形势与政策(二)", - "形势与政策(三)", - "形势与政策(四)", - "形势与政策(五)", - "形势与政策(六)", - "形势与政策", - "体育(一)", - "体育(二)", - "体育(三)", - "体育(四)", - "大学生安全教育(一)", - "大学生安全教育(二)", - "大学生安全教育(三)", - "大学生安全教育(四)", - "大学生安全教育(五)", - "大学生安全教育(六)", -]; + +final List containCourseTypes = ["实践教学环节", "专业核心课", "专业基础课"]; final List colorList = const [ Colors.red, @@ -297,6 +230,6 @@ bool isLoggedIn() { return AppData.persistentData["username"] != ""; } -bool isExcludedCourse(String courseName) { - return excludedCourses.contains(courseName); +bool isContainCourse(String courseType) { + return containCourseTypes.contains(courseType); } diff --git a/lib/pages/queryScore.dart b/lib/pages/queryScore.dart index 024192c..0f87154 100644 --- a/lib/pages/queryScore.dart +++ b/lib/pages/queryScore.dart @@ -88,14 +88,10 @@ class _QueryBodyState extends State { process(List list) { queryScore = list; // 绩点 - double gradePointAverage = 0.0; - double average = 0.0; - double weight = 0.0; + double gradePointSummary = 0.0; double scoreSummary = 0.0; - //学分*成绩 - double weightScoreSummary = 0.0; - double gradePointAverageSummary = 0.0; double creditSummary = 0.0; + int excluded = 0; for (int i = 0; i < list.length; i++) { @@ -113,15 +109,17 @@ class _QueryBodyState extends State { double gradePoint = double.parse(list[i]![6]); String courseName = list[i]![2].toString(); String teacher = list[i]![3]; + String type = list[i]![7]; - if ((courseName.contains("慕课") && teacher == "") || isExcludedCourse(courseName)) { + if ((courseName.contains("慕课") && teacher == "")) { excluded++; } else { if (list[i].length > 5) { print(list[i]); - weightScoreSummary += score * credit; - creditSummary += credit; - gradePointAverageSummary += gradePoint * credit; + if (isContainCourse(type)) { + gradePointSummary += gradePoint * credit; + creditSummary += credit; + } } if (list[i].length > 4) { scoreSummary += score; @@ -130,13 +128,14 @@ class _QueryBodyState extends State { } print(scoreSummary); - average = double.parse((scoreSummary / (list.length - excluded)).toStringAsFixed(1)); - weight = double.parse((weightScoreSummary / creditSummary).toStringAsFixed(1)); - gradePointAverage = double.parse((gradePointAverageSummary / creditSummary).toStringAsFixed(1)); - if (average.isNaN) average = 0.0; - if (weight.isNaN) weight = 0.0; - if (gradePointAverage.isNaN) gradePointAverage = 0.0; - scores = [gradePointAverage, average, weight]; + + double scoreAverage = double.parse((scoreSummary / (list.length - excluded)).toStringAsFixed(2)); + double gradePointAverage = double.parse((gradePointSummary / creditSummary).toStringAsFixed(2)); + + if (gradePointAverage.isNaN) gradePointSummary = 0.0; + if (scoreAverage.isNaN) scoreSummary = 0.0; + + scores = [gradePointAverage, scoreAverage]; ScaffoldMessenger.of(context).removeCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar(jwSnackBar(1, "数据已更新!", 1)); setState(() {}); @@ -289,7 +288,7 @@ class _QueryBodyState extends State { height: 8, ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.start, children: [ Text( "平均绩点: ${scores[0]}", @@ -302,14 +301,6 @@ class _QueryBodyState extends State { Text( "算术平均分: ${scores[1]}", style: TextStyle(color: Colors.white), - ), - Text( - "|", - style: TextStyle(color: readColor()), - ), - Text( - "加权平均分: ${scores[2]}", - style: TextStyle(color: Colors.white), ) ], ) diff --git a/pubspec.yaml b/pubspec.yaml index 9f47639..ea6e91b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "https://pub.flutter-io.cn" # Remove this line if you wish to publis # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.6.241225+75 +version: 1.6.250208+76 environment: sdk: ">=2.14.0 <4.0.0"