16 | | SELECT DISTINCT "camps_offer"."id", "camps_offer"."title", "camps_offer"."slug", "camps_offer"."is_active", "camps_offer"."modified", "camps_offer"."created", "camps_offer"."provider_id", "camps_offer"."activity_type", "camps_offer"."description", "camps_offer"."highlights", "camps_offer"."important_information", "camps_offer"."min_age", "camps_offer"."max_age", "camps_offer"."food", "camps_offer"."video", "camps_offer"."accommodation", "camps_offer"."accommodation_type", "camps_offer"."room_type", "camps_offer"."room_size_min", "camps_offer"."room_size_max", "camps_offer"."external_url", "camps_offer"."application_form", "camps_offer"."caseload", "camps_offer"."field_trips", MIN(T4."retail_price") AS "min_retail_price", (SELECT U0."id" FROM "camps_servicepackage" U0 INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id") WHERE (U0."company_id" = 1 AND U0."option" = "camps_offer"."activity_type" AND ST_Contains(U2."locations", T4."position")) LIMIT 1) AS "in_package", "camps_provider"."id", "camps_provider"."title", "camps_provider"."slug", "camps_provider"."is_active", "camps_provider"."modified", "camps_provider"."created", "camps_provider"."logo", "camps_provider"."description", "camps_provider"."video", "camps_provider"."external_url", "camps_provider"."terms", "camps_provider"."cancellation_policy", "camps_provider"."privacy_policy", "camps_provider"."application_form" FROM "camps_offer" LEFT OUTER JOIN "camps_bookingoption" ON ("camps_offer"."id" = "camps_bookingoption"."offer_id") INNER JOIN "camps_provider" ON ("camps_offer"."provider_id" = "camps_provider"."id") INNER JOIN "camps_bookingoption" T4 ON ("camps_offer"."id" = T4."offer_id") WHERE ("camps_offer"."is_active" = True AND "camps_provider"."is_active" = True AND T4."end" >= STATEMENT_TIMESTAMP() AND T4."is_active" = True AND (SELECT U0."id" FROM "camps_servicepackage" U0 INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id") WHERE (U0."company_id" = 1 AND U0."option" = "camps_offer"."activity_type" AND ST_Contains(U2."locations", T4."position")) LIMIT 1) IS NOT NULL) GROUP BY "camps_offer"."id", "camps_provider"."id" ORDER BY "camps_offer"."created" ASC |
| 16 | SELECT DISTINCT "camps_offer"."id", |
| 17 | "camps_offer"."title", |
| 18 | "camps_offer"."slug", |
| 19 | "camps_offer"."is_active", |
| 20 | "camps_offer"."modified", |
| 21 | "camps_offer"."created", |
| 22 | "camps_offer"."provider_id", |
| 23 | "camps_offer"."activity_type", |
| 24 | "camps_offer"."description", |
| 25 | "camps_offer"."highlights", |
| 26 | "camps_offer"."important_information", |
| 27 | "camps_offer"."min_age", |
| 28 | "camps_offer"."max_age", |
| 29 | "camps_offer"."food", |
| 30 | "camps_offer"."video", |
| 31 | "camps_offer"."accommodation", |
| 32 | "camps_offer"."accommodation_type", |
| 33 | "camps_offer"."room_type", |
| 34 | "camps_offer"."room_size_min", |
| 35 | "camps_offer"."room_size_max", |
| 36 | "camps_offer"."external_url", |
| 37 | "camps_offer"."application_form", |
| 38 | "camps_offer"."caseload", |
| 39 | "camps_offer"."field_trips", |
| 40 | MIN(T4."retail_price") AS "min_retail_price", |
| 41 | (SELECT U0."id" |
| 42 | FROM "camps_servicepackage" U0 |
| 43 | INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id") |
| 44 | WHERE (U0."company_id" = 1 AND U0."option" = "camps_offer"."activity_type" AND |
| 45 | ST_Contains(U2."locations", T4."position")) |
| 46 | LIMIT 1) AS "in_package", |
| 47 | "camps_provider"."id", |
| 48 | "camps_provider"."title", |
| 49 | "camps_provider"."slug", |
| 50 | "camps_provider"."is_active", |
| 51 | "camps_provider"."modified", |
| 52 | "camps_provider"."created", |
| 53 | "camps_provider"."logo", |
| 54 | "camps_provider"."description", |
| 55 | "camps_provider"."video", |
| 56 | "camps_provider"."external_url", |
| 57 | "camps_provider"."terms", |
| 58 | "camps_provider"."cancellation_policy", |
| 59 | "camps_provider"."privacy_policy", |
| 60 | "camps_provider"."application_form" |
| 61 | FROM "camps_offer" |
| 62 | LEFT OUTER JOIN "camps_bookingoption" ON ("camps_offer"."id" = "camps_bookingoption"."offer_id") |
| 63 | INNER JOIN "camps_provider" ON ("camps_offer"."provider_id" = "camps_provider"."id") |
| 64 | INNER JOIN "camps_bookingoption" T4 ON ("camps_offer"."id" = T4."offer_id") |
| 65 | WHERE ("camps_offer"."is_active" = True AND "camps_provider"."is_active" = True AND |
| 66 | T4."end" >= STATEMENT_TIMESTAMP() AND T4."is_active" = True AND (SELECT U0."id" |
| 67 | FROM "camps_servicepackage" U0 |
| 68 | INNER JOIN "camps_region" U2 ON (U0."region_id" = U2."id") |
| 69 | WHERE (U0."company_id" = 1 AND |
| 70 | U0."option" = "camps_offer"."activity_type" AND |
| 71 | ST_Contains(U2."locations", T4."position")) |
| 72 | LIMIT 1) IS NOT NULL) |
| 73 | GROUP BY "camps_offer"."id", "camps_provider"."id" |
| 74 | ORDER BY "camps_offer"."created" ASC |