From c3b9f8d43fb8adb9f4e5ce35c99c36c2fe30e167 Mon Sep 17 00:00:00 2001 From: rupakkorde Date: Thu, 19 Dec 2024 16:08:27 +0530 Subject: [PATCH] potential/fix --- .github/workflows/nix.yml | 7 ++----- .../src/common/types.rs | 1 + .../src/domain/action/internal/location.rs | 19 +++++++++++++++++++ .../src/redis/commands.rs | 2 ++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index a3a50e8..1dad603 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -1,8 +1,8 @@ name: CI permissions: - contents: read - packages: write + contents: read + packages: write on: push: @@ -34,13 +34,11 @@ jobs: - name: Docker tasks id: docker - if: (github.ref == 'refs/heads/main') run: | nix build .#dockerImage -o docker-image.tgz echo "image_name=$(nix eval --raw .#dockerImage.imageName):$(nix eval --raw .#dockerImage.imageTag)" >> $GITHUB_OUTPUT - name: Upload Docker image tarball - if: (github.ref == 'refs/heads/main') uses: actions/upload-artifact@v4 with: name: docker-image @@ -49,7 +47,6 @@ jobs: push-docker: needs: build runs-on: ubuntu-latest - if: (github.ref == 'refs/heads/main') steps: - name: Download Docker image tarball uses: actions/download-artifact@v4 diff --git a/crates/location_tracking_service/src/common/types.rs b/crates/location_tracking_service/src/common/types.rs index 65719f1..1e7d103 100644 --- a/crates/location_tracking_service/src/common/types.rs +++ b/crates/location_tracking_service/src/common/types.rs @@ -135,6 +135,7 @@ pub struct AuthData { pub merchant_operating_city_id: MerchantOperatingCityId, } +#[derive(Debug, Deserialize, Serialize)] pub struct DriverLocationPoint { pub driver_id: DriverId, pub location: Point, diff --git a/crates/location_tracking_service/src/domain/action/internal/location.rs b/crates/location_tracking_service/src/domain/action/internal/location.rs index 90f3cfc..14afbe8 100644 --- a/crates/location_tracking_service/src/domain/action/internal/location.rs +++ b/crates/location_tracking_service/src/domain/action/internal/location.rs @@ -48,6 +48,8 @@ async fn search_nearby_drivers_with_vehicle( ) .await?; + info!("Drivers in nearby {:?}", nearby_drivers); + let driver_ids: Vec = nearby_drivers .iter() .map(|driver| driver.driver_id.to_owned()) @@ -75,6 +77,8 @@ async fn search_nearby_drivers_with_vehicle( }) .collect::>(); + info!("Final resp {:?}", resp); + Ok(resp) } @@ -93,8 +97,22 @@ pub async fn get_nearby_drivers( let current_bucket = get_bucket_from_timestamp(&data.bucket_size, TimeStamp(Utc::now())); + info!("lat type before {:?}", lat); + info!("lon type before {:?}", lon); + info!("type type before {:?}", vehicle_type); + info!("radius type before {:?}", radius); + info!("mid type before {:?}", merchant_id); + + let vehicle_type = match vehicle_type { + Some(ref vec) if vec.is_empty() => None, + _ => vehicle_type, + }; + + info!("Vehicle type after {:?}", vehicle_type); + match vehicle_type { None => { + info!("Woohoo 3"); let mut resp: Vec = Vec::new(); for vehicle in VehicleType::iter() { @@ -122,6 +140,7 @@ pub async fn get_nearby_drivers( Ok(resp) } Some(vehicles) => { + info!("Woohoo 1"); let mut resp: Vec = Vec::new(); for vehicle in vehicles { let nearby_drivers = search_nearby_drivers_with_vehicle( diff --git a/crates/location_tracking_service/src/redis/commands.rs b/crates/location_tracking_service/src/redis/commands.rs index 6a9252f..efe1eb2 100644 --- a/crates/location_tracking_service/src/redis/commands.rs +++ b/crates/location_tracking_service/src/redis/commands.rs @@ -218,6 +218,8 @@ pub async fn get_drivers_within_radius( .await .map_err(|err| AppError::InternalError(err.to_string()))?; + info!("Get Nearby Drivers 1 {:?}", nearby_drivers); + let nearby_drivers: Vec<(DriverId, Point)> = cat_maybes(nearby_drivers) .into_iter() .map(|(driver_id, point)| {