fixed position error and added goad condition button

This commit is contained in:
2024-03-05 19:32:42 +05:30
parent 773650be82
commit 2f329669e9
4 changed files with 71 additions and 52 deletions

View File

@ -44,20 +44,26 @@ class GpsDatabaseHelper {
}
Future<int> insertGps(GpsData gps) async {
Database db = await instance.database;
int? nextOrder =
Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM gps'));
nextOrder = nextOrder ?? 0;
nextOrder = nextOrder + 1;
gps.id = nextOrder;
//print("---- insering ${gps.toMap()}");
int res = await db.insert(
'gps',
gps.toMap(),
conflictAlgorithm: ConflictAlgorithm.replace,
);
//print("------ database helper insert $res-----------::::::::");
return res;
try {
print("---- try insering ${gps.toMap()}");
Database db = await instance.database;
int? nextOrder =
Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM gps'));
nextOrder = nextOrder ?? 0;
nextOrder = nextOrder + 1;
gps.id = nextOrder;
print("---- insering ${gps.toMap()}");
int res = await db.insert(
'gps',
gps.toMap(),
conflictAlgorithm: ConflictAlgorithm.replace,
);
print("------ database helper insert $res-----------::::::::");
return res;
} catch (err) {
print("------ error $err-----------::::::::");
return -1;
}
}
Future<List<GpsData>> getGPSData(String team_name, String event_code) async {