<commit_before>(SELECT
  <% if (is_utf_grid) { %>
  ST_AsGeoJSON(block.geom) AS geojson,
  <% } %>
  block.geom, block.id, CASE WHEN block.is_available AND reservation.user_id = <%= user_id %> THEN  'reserved' ELSE 'unavailable' END as survey_type
  FROM survey_blockface AS block
  LEFT OUTER JOIN survey_blockfacereservation AS reservation
    ON (block.id = reservation.blockface_id
        AND reservation.canceled_at IS NULL
        AND reservation.user_id = <%= user_id %>
        AND reservation.expires_at > now() at time zone 'utc')
  <% if (is_utf_grid) { %>
    WHERE reservation.user_id = <%= user_id %>
  <% } %>
) AS query
<commit_msg>Prevent selecting unavailable blocks on survey<commit_after>(SELECT
  <% if (is_utf_grid) { %>
  ST_AsGeoJSON(block.geom) AS geojson,
  <% } %>
  block.geom, block.id, CASE WHEN block.is_available AND reservation.user_id = <%= user_id %> THEN  'reserved' ELSE 'unavailable' END as survey_type
  FROM survey_blockface AS block
  LEFT OUTER JOIN survey_blockfacereservation AS reservation
    ON (block.id = reservation.blockface_id
        AND reservation.canceled_at IS NULL
        AND reservation.user_id = <%= user_id %>
        AND reservation.expires_at > now() at time zone 'utc')
  <% if (is_utf_grid) { %>
    WHERE block.is_available AND reservation.user_id = <%= user_id %>
  <% } %>
) AS query

{'fraction_non_alphanumeric': 0.11152141802067947, 'fraction_numerical': 0.0, 'mean_word_length': 3.721254355400697, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5756089', 'n_tokens_mistral': 496, 'n_tokens_neox': 432, 'n_words': 117}