Fix failed specs

This commit is contained in:
Eugene Burmakin 2025-09-23 00:18:04 +02:00
parent 54a2a29c18
commit a84fde553e
4 changed files with 10 additions and 11 deletions

View file

@ -49,7 +49,7 @@ module LocationSearch
# Calculate visit duration
duration_minutes =
if sorted_points.any?
if sorted_points.length > 1
((last_point[:timestamp] - first_point[:timestamp]) / 60.0).round
else
# Single point visit - estimate based on typical stay time

View file

@ -47,10 +47,9 @@
<div class="p-4 border-b border-base-300 bg-base-50">
<div class="flex justify-between items-center">
<div class="flex items-center gap-4">
<h3 class="font-semibold text-lg">📍 Location Hexagons</h3>
<% if @hexagons_available %>
<div class="badge badge-success badge-sm">H3 Enhanced</div>
<% end %>
<h3 class="font-semibold text-lg flex items-center gap-2">
<%= icon 'map' %> Location Hexagons
</h3>
</div>
</div>
</div>

View file

@ -172,11 +172,11 @@ RSpec.describe 'Api::V1::Maps::Hexagons', type: :request do
context 'with pre-calculated hexagon centers' do
let(:pre_calculated_centers) do
{
'8a1fb46622dffff' => [5, 1_717_200_000, 1_717_203_600], # count, earliest, latest timestamps
'8a1fb46622e7fff' => [3, 1_717_210_000, 1_717_213_600],
'8a1fb46632dffff' => [8, 1_717_220_000, 1_717_223_600]
}
[
['8a1fb46622dffff', 5, 1_717_200_000, 1_717_203_600], # h3_index, count, earliest, latest timestamps
['8a1fb46622e7fff', 3, 1_717_210_000, 1_717_213_600],
['8a1fb46632dffff', 8, 1_717_220_000, 1_717_223_600]
]
end
let(:stat) do
create(:stat, :with_sharing_enabled, user:, year: 2024, month: 6, h3_hex_ids: pre_calculated_centers)

View file

@ -7,7 +7,7 @@ RSpec.describe Api::PointSerializer do
subject(:serializer) { described_class.new(point).call }
let(:point) { create(:point) }
let(:all_excluded) { PointSerializer::EXCLUDED_ATTRIBUTES + Api::PointSerializer::ADDITIONAL_EXCLUDED_ATTRIBUTES }
let(:all_excluded) { Api::PointSerializer::EXCLUDED_ATTRIBUTES }
let(:expected_json) do
point.attributes.except(*all_excluded).tap do |attributes|
# API serializer extracts coordinates from PostGIS geometry