From 0210c31b756c6bef54a0f19f1ca9c9454f3036fb Mon Sep 17 00:00:00 2001 From: Sujit Kumar Date: Tue, 12 Jan 2021 13:17:39 +0530 Subject: [PATCH] Removed Remark while displaying Marks --- .../vtopchennai/MarksActivity.java | 9 ++++---- .../java/tk/therealsuji/vtopchennai/VTOP.java | 23 ++++--------------- app/src/main/res/values/strings.xml | 1 - 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/tk/therealsuji/vtopchennai/MarksActivity.java b/app/src/main/java/tk/therealsuji/vtopchennai/MarksActivity.java index ecd60e08..7ceaf74d 100644 --- a/app/src/main/java/tk/therealsuji/vtopchennai/MarksActivity.java +++ b/app/src/main/java/tk/therealsuji/vtopchennai/MarksActivity.java @@ -66,7 +66,7 @@ protected void onCreate(Bundle savedInstanceState) { public void run() { SQLiteDatabase myDatabase = context.openOrCreateDatabase("vtop", Context.MODE_PRIVATE, null); - myDatabase.execSQL("CREATE TABLE IF NOT EXISTS marks (id INT(3) PRIMARY KEY, course VARCHAR, type VARCHAR, title VARCHAR, score VARCHAR, status VARCHAR, weightage VARCHAR, average VARCHAR, posted VARCHAR, remark VARCHAR)"); + myDatabase.execSQL("CREATE TABLE IF NOT EXISTS marks (id INT(3) PRIMARY KEY, course VARCHAR, type VARCHAR, title VARCHAR, score VARCHAR, status VARCHAR, weightage VARCHAR, average VARCHAR, posted VARCHAR)"); Cursor c = myDatabase.rawQuery("SELECT DISTINCT title FROM marks", null); int titleIndex = c.getColumnIndex("title"); @@ -141,10 +141,9 @@ public void run() { int statusIndex = s.getColumnIndex("status"); int weightageIndex = s.getColumnIndex("weightage"); int averageIndex = s.getColumnIndex("average"); - int remarkIndex = s.getColumnIndex("remark"); - int[] indexes = {typeIndex, scoreIndex, weightageIndex, averageIndex, statusIndex, remarkIndex}; - String[] titles = {getString(R.string.type), getString(R.string.score), getString(R.string.weightage), getString(R.string.average), getString(R.string.status), getString(R.string.remark)}; + int[] indexes = {typeIndex, scoreIndex, weightageIndex, averageIndex, statusIndex}; + String[] titles = {getString(R.string.type), getString(R.string.score), getString(R.string.weightage), getString(R.string.average), getString(R.string.status)}; s.moveToFirst(); @@ -184,7 +183,7 @@ public void run() { block.addView(course); //Adding the course to block - for (int k = 0; k < 6; ++k) { + for (int k = 0; k < 5; ++k) { String valueString = s.getString(indexes[k]); if (!valueString.equals("")) { /* diff --git a/app/src/main/java/tk/therealsuji/vtopchennai/VTOP.java b/app/src/main/java/tk/therealsuji/vtopchennai/VTOP.java index b2cad56a..31611904 100644 --- a/app/src/main/java/tk/therealsuji/vtopchennai/VTOP.java +++ b/app/src/main/java/tk/therealsuji/vtopchennai/VTOP.java @@ -1354,7 +1354,7 @@ public void downloadMarks() { " var rows = doc.getElementById('fixedTableContainer').getElementsByTagName('tr');" + " var heads = rows[0].getElementsByTagName('td');" + " var columns = heads.length;" + - " var courseIndex, typeIndex, titleIndex, maxIndex, percentIndex, statusIndex, scoredIndex, weightageIndex, averageIndex, postedIndex, remarkIndex;" + + " var courseIndex, typeIndex, titleIndex, maxIndex, percentIndex, statusIndex, scoredIndex, weightageIndex, averageIndex, postedIndex;" + " var course = '', type = '', flag = 0, k = 0;" + " for (var i = 0; i < columns; ++i) {" + " var heading = heads[i].innerText.toLowerCase();" + @@ -1380,41 +1380,30 @@ public void downloadMarks() { " var heading = heads[j].innerText.toLowerCase();" + " if (heading.includes('title')) {" + " titleIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('max')) {" + " maxIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('%')) {" + " percentIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('status')) {" + " statusIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('scored')) {" + " scoredIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('weightage') && heading.includes('mark')) {" + " weightageIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('average')) {" + " averageIndex = j;" + - " ++flag;" + " }" + " if (heading.includes('posted')) {" + " postedIndex = j;" + - " ++flag;" + " }" + - " if (heading.includes('remark')) {" + - " remarkIndex = j;" + - " ++flag;" + - " }" + " }" + + " ++flag;" + " }" + " for (var j = 0; j < records; ++j) {" + " var values = rows[++i].getElementsByTagName('td');" + @@ -1427,7 +1416,6 @@ public void downloadMarks() { " temp['weightage'] = values[weightageIndex].innerText.trim();" + " temp['average'] = values[averageIndex].innerText.trim();" + " temp['posted'] = values[postedIndex].innerText.trim();" + - " temp['remark'] = values[remarkIndex].innerText.trim();" + " temp['course'] = course;" + " temp['type'] = type;" + " obj[k++] = temp;" + @@ -1453,7 +1441,7 @@ public void onReceiveValue(final String obj) { public void run() { try { myDatabase.execSQL("DROP TABLE IF EXISTS marks"); - myDatabase.execSQL("CREATE TABLE IF NOT EXISTS marks (id INTEGER PRIMARY KEY, course VARCHAR, type VARCHAR, title VARCHAR, score VARCHAR, status VARCHAR, weightage VARCHAR, average VARCHAR, posted VARCHAR, remark VARCHAR)"); + myDatabase.execSQL("CREATE TABLE IF NOT EXISTS marks (id INTEGER PRIMARY KEY, course VARCHAR, type VARCHAR, title VARCHAR, score VARCHAR, status VARCHAR, weightage VARCHAR, average VARCHAR, posted VARCHAR)"); ((Activity) context).runOnUiThread(new Runnable() { @Override @@ -1475,7 +1463,7 @@ public void run() { JSONObject myObj = new JSONObject(obj); myDatabase.execSQL("DROP TABLE IF EXISTS marks"); - myDatabase.execSQL("CREATE TABLE IF NOT EXISTS marks (id INTEGER PRIMARY KEY, course VARCHAR, type VARCHAR, title VARCHAR, score VARCHAR, status VARCHAR, weightage VARCHAR, average VARCHAR, posted VARCHAR, remark VARCHAR)"); + myDatabase.execSQL("CREATE TABLE IF NOT EXISTS marks (id INTEGER PRIMARY KEY, course VARCHAR, type VARCHAR, title VARCHAR, score VARCHAR, status VARCHAR, weightage VARCHAR, average VARCHAR, posted VARCHAR)"); for (int i = 0; i < myObj.length(); ++i) { JSONObject tempObj = new JSONObject(myObj.getString(Integer.toString(i))); @@ -1487,9 +1475,8 @@ public void run() { String weightage = tempObj.getString("weightage") + " / " + tempObj.getString("percent"); String average = tempObj.getString("average"); String posted = tempObj.getString("posted"); - String remark = tempObj.getString("remark"); - myDatabase.execSQL("INSERT INTO marks (course, type, title, score, status, weightage, average, posted, remark) VALUES('" + course + "', '" + type + "', '" + title + "', '" + score + "', '" + status + "', '" + weightage + "', '" + average + "', '" + posted + "', '" + remark + "')"); + myDatabase.execSQL("INSERT INTO marks (course, type, title, score, status, weightage, average, posted) VALUES('" + course + "', '" + type + "', '" + title + "', '" + score + "', '" + status + "', '" + weightage + "', '" + average + "', '" + posted + "')"); } ((Activity) context).runOnUiThread(new Runnable() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7c600a59..10c1a75d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -124,7 +124,6 @@ Weightage Score Status Class Average - Remark Proctor