update status

This commit is contained in:
Mohamed Nouffer
2023-09-08 21:19:12 +05:30
parent 720dd149a9
commit 6f3249631f
8 changed files with 135 additions and 36 deletions

View File

@ -114,12 +114,13 @@ class DestinationController extends GetxController {
if (checkinRadious >= distance) {
indexController.currentFeature.clear();
Destination d = festuretoDestination(fs);
for (Destination de in destinations) {
if (de.location_id == d.location_id) {
d = de;
break;
}
}
print("----- destination lenght is ${destinations.length} -----");
// for (Destination de in destinations) {
// if (de.location_id == d.location_id) {
// d = de;
// break;
// }
// }
indexController.currentFeature.add(fs);
print("---- before calling startTimer ----");
startTimer(d, distance);
@ -130,9 +131,13 @@ class DestinationController extends GetxController {
print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
skip_gps = true;
print("---- in startTimer ----");
DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
double checkinRadious = d.checkin_radious ?? double.infinity;
bool autoCheckin = d.auto_checkin == 0 ? false : true;
bool locationAlreadyCheckedIn = d.checkedin ?? false;
bool locationAlreadyCheckedIn = ds.length > 0 && ds[0].checkedin == true ? true : false;
bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false;
//make current destination
print("---- checkin_radious $checkinRadious ----");
@ -165,8 +170,6 @@ class DestinationController extends GetxController {
return;
}
DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
if (ds.isEmpty) {
print("----- in location popup cp - ${d.cp}----");
if (d.cp == -1 && DateTime.now().difference(last_goal_at).inHours >= 24) {
@ -435,32 +438,32 @@ class DestinationController extends GetxController {
void checkForCheckin(double la, double ln) {
print("--- skip_gps ---- $skip_gps----");
for (final d in destinations) {
print("--- check checkin for--loc_id- ${d.sub_loc_id}----");
// for (final d in destinations) {
// print("--- check checkin for--loc_id- ${d.sub_loc_id}----");
double lat = d.lat!;
double lon = d.lon!;
LatLng p = LatLng(lat, lon);
getDestinationForLatLong(lat, lon).then((value) {
var distance = const Distance();
double dist =
distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
//double checkin_radious = value!.checkin_radious ?? double.infinity;
//bool auto_checkin = value.auto_checkin == 0 ? false : true;
//bool location_already_checked_id = d.checkedin ?? false;
// double lat = d.lat!;
// double lon = d.lon!;
// LatLng p = LatLng(lat, lon);
// getDestinationForLatLong(lat, lon).then((value) {
// var distance = const Distance();
// double dist =
// distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
// //double checkin_radious = value!.checkin_radious ?? double.infinity;
// //bool auto_checkin = value.auto_checkin == 0 ? false : true;
// //bool location_already_checked_id = d.checkedin ?? false;
// print("-----rogaining_counted---${rogaining_counted.value}-----");
// print("-----is_in_rog---${is_in_rog}-----");
// print("-----dist is ---${dist}-----");
//print("----- ${indexController.currentUser} ----");
// // print("-----rogaining_counted---${rogaining_counted.value}-----");
// // print("-----is_in_rog---${is_in_rog}-----");
// // print("-----dist is ---${dist}-----");
// //print("----- ${indexController.currentUser} ----");
if (dist <= 250 && skip_gps == false) {
//near a destination
print("---- time with ${d.location_id} ----");
startTimer(d, dist);
}
});
}
// if (dist <= 250 && skip_gps == false) {
// //near a destination
// print("---- time with ${d.location_id} ----");
// startTimer(d, dist);
// }
// });
// }
if (indexController.locations.isEmpty) return;