From bf0b5a77b10ef3cf3171b127e1dd09dd1d6e361c Mon Sep 17 00:00:00 2001 From: Ezhil Shanmugham Date: Sun, 31 Mar 2024 18:44:31 +0530 Subject: [PATCH] Update Overall Attendance --- .../tk/therealsuji/vtopchennai/services/VTOPService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/tk/therealsuji/vtopchennai/services/VTOPService.java b/app/src/main/java/tk/therealsuji/vtopchennai/services/VTOPService.java index 402bee5..274a75b 100644 --- a/app/src/main/java/tk/therealsuji/vtopchennai/services/VTOPService.java +++ b/app/src/main/java/tk/therealsuji/vtopchennai/services/VTOPService.java @@ -1299,8 +1299,6 @@ private void downloadAttendance() { JSONArray attendanceArray = response.getJSONArray("attendance"); List attendance = new ArrayList<>(); - int overallAttendance = 0; - int attendedClasses = 0; int totalClasses = 0; @@ -1328,8 +1326,10 @@ private void downloadAttendance() { attendance.add(attendanceItem); } + int overallAttendance = 0; + if (totalClasses != 0) { - overallAttendance = (int) ((attendedClasses * 100) / totalClasses); + overallAttendance = (attendedClasses * 100) / totalClasses; } sharedPreferences.edit().putInt("overallAttendance", (int) overallAttendance).apply();