From 539561c8d8790b2d6a685b74256f2deede34514a Mon Sep 17 00:00:00 2001 From: pjpatil12 Date: Thu, 22 Jan 2026 13:39:14 +0530 Subject: [PATCH] update code --- .../__pycache__/CITHandler.cpython-313.pyc | Bin 5236 -> 5236 bytes AppCode/__pycache__/YearGet.cpython-313.pyc | Bin 2580 -> 2580 bytes main.py | 29 ++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/AppCode/__pycache__/CITHandler.cpython-313.pyc b/AppCode/__pycache__/CITHandler.cpython-313.pyc index 9203dce302758828ca828acfe3359ba1c322c8da..9a2d002cf60988646c3c77816ad8a5ec6cfa117a 100644 GIT binary patch delta 20 acmeyO@kN9CGcPX}0}v$MDBQ@MDFOgUX9hk1 delta 20 acmeyO@kN9CGcPX}0}yELEZE4MDFOgSAO+?C diff --git a/AppCode/__pycache__/YearGet.cpython-313.pyc b/AppCode/__pycache__/YearGet.cpython-313.pyc index 9f34ccd69b5d449172da4016fd3d18bb01c0144d..ca19b356f3ca9a395aafa00c6329fb5b9d76fba0 100644 GIT binary patch delta 20 acmbOtGDU>@GcPX}0}vQqE8NJ<$prv4F$B5* delta 20 acmbOtGDU>@GcPX}0}%W;P_U7klM4Vk83k$p diff --git a/main.py b/main.py index a0c5e77..ba84d06 100644 --- a/main.py +++ b/main.py @@ -128,8 +128,8 @@ def update_itr(id): itr = ITRHandler() if request.method == 'POST': - # data = {k: request.form.get(k, 0) for k in request.form} - itr.update(id, request.form) + data = {k: request.form.get(k, 0) for k in request.form} + itr.update(id, data) itr.close() return redirect(url_for('display_itr')) @@ -247,8 +247,8 @@ def update_cit(id): return "CIT record not found", 404 if request.method == 'POST': - # data = {k: request.form.get(k, 0) for k in request.form} - cit.update_cit(id, request.form) + data = {k: request.form.get(k, 0) for k in request.form} + cit.update_cit(id, data) cit.close() return redirect(url_for('display_cit')) @@ -275,8 +275,8 @@ def display_itat(): def add_itat(): if request.method == 'POST': itat = ITATHandler() - # data = {k: request.form.get(k, 0) for k in request.form} - itat.add_itat(request.form) + data = {k: request.form.get(k, 0) for k in request.form} + itat.add_itat(data) itat.close() flash("ITAT record added successfully!", "success") return redirect(url_for('display_itat')) @@ -455,7 +455,24 @@ def summary_report(): # check_year_obj = YearGet() # result = check_year_obj.CheckYearExists(table_name, year) # check_year_obj.close() +# return result +@app.route('/check_year', methods=['POST']) +def check_year(): + table_name = request.json.get("table") + year = request.json.get("year") + + conn = DBConfig.get_db_connection() + cursor = conn.cursor() + + sqlstr = f"SELECT COUNT(*) FROM {table_name} WHERE year = %s" + cursor.execute(sqlstr, (year,)) + result = cursor.fetchone()[0] + + cursor.close() + conn.close() + + return {"exists": result > 0} # Mat credit from @app.route("/mat_credit", methods=["GET"])