Skip to content

Commit ec930e1

Browse files
committed
fix(marks): When total is not given marks will be calculated accordingly
1 parent 3def5a2 commit ec930e1

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

frontend/lib/pages/marks.dart

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class _MarksState extends State<Marks> {
2929
final Map<String, String> body = {
3030
"__RequestVerificationToken": SessionManager.rf ?? "",
3131
"ASP.NET_SessionId": SessionManager.asp ?? "",
32+
"Enrollment": "",
33+
"Semester": selectedSemester!,
3234
};
3335

3436
try {
@@ -37,7 +39,46 @@ class _MarksState extends State<Marks> {
3739
if (response.statusCode == 200) {
3840
setState(() {
3941
marksData = List<Map<String, dynamic>>.from(
40-
response.data["InternalMarksList"]);
42+
(response.data["InternalMarksList"] as List).map((course) {
43+
final courseMap = Map<String, dynamic>.from(course);
44+
45+
double total = 0.0;
46+
double maxMarks = 100;
47+
48+
double mte1 =
49+
double.tryParse(courseMap['MTE1']?.toString() ?? "0") ?? 0;
50+
double mte2 =
51+
double.tryParse(courseMap['MTE2']?.toString() ?? "0") ?? 0;
52+
double cws =
53+
double.tryParse(courseMap['CWS']?.toString() ?? "0") ?? 0;
54+
double ete =
55+
double.tryParse(courseMap['ETE']?.toString() ?? "0") ?? 0;
56+
double prs =
57+
double.tryParse(courseMap['PRS']?.toString() ?? "0") ?? 0;
58+
59+
if (courseMap['Total'] == "-") {
60+
if (prs > 0) {
61+
total = prs;
62+
maxMarks = 60;
63+
} else if (mte1 > 0 && mte2 > 0) {
64+
total = mte1 + mte2 + cws + ete;
65+
maxMarks = 100; // 40 + 20 + 40
66+
} else if (mte1 > 0) {
67+
total = mte1 + cws + ete;
68+
maxMarks = 100; // 30 + 30 + 40
69+
}
70+
} else {
71+
total = double.tryParse(courseMap['Total']?.toString() ?? "0") ?? 0;
72+
}
73+
74+
courseMap['RESESSION'] = courseMap['RESESSION'] ?? "-";
75+
76+
return {
77+
...courseMap,
78+
'Total': total,
79+
'MaxMarks': maxMarks,
80+
};
81+
}));
4182
isLoading = false;
4283
});
4384
} else {

frontend/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1616
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
1717
# In Windows, build-name is used as the major, minor, and patch parts
1818
# of the product and file versions while build-number is used as the build suffix.
19-
version: 1.0.7+1
19+
version: 1.0.8+1
2020

2121
environment:
2222
sdk: ^3.5.4

0 commit comments

Comments
 (0)