mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Fix failed specs
This commit is contained in:
parent
54a2a29c18
commit
a84fde553e
4 changed files with 10 additions and 11 deletions
|
|
@ -49,7 +49,7 @@ module LocationSearch
|
||||||
|
|
||||||
# Calculate visit duration
|
# Calculate visit duration
|
||||||
duration_minutes =
|
duration_minutes =
|
||||||
if sorted_points.any?
|
if sorted_points.length > 1
|
||||||
((last_point[:timestamp] - first_point[:timestamp]) / 60.0).round
|
((last_point[:timestamp] - first_point[:timestamp]) / 60.0).round
|
||||||
else
|
else
|
||||||
# Single point visit - estimate based on typical stay time
|
# Single point visit - estimate based on typical stay time
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,9 @@
|
||||||
<div class="p-4 border-b border-base-300 bg-base-50">
|
<div class="p-4 border-b border-base-300 bg-base-50">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<h3 class="font-semibold text-lg">📍 Location Hexagons</h3>
|
<h3 class="font-semibold text-lg flex items-center gap-2">
|
||||||
<% if @hexagons_available %>
|
<%= icon 'map' %> Location Hexagons
|
||||||
<div class="badge badge-success badge-sm">H3 Enhanced</div>
|
</h3>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -172,11 +172,11 @@ RSpec.describe 'Api::V1::Maps::Hexagons', type: :request do
|
||||||
|
|
||||||
context 'with pre-calculated hexagon centers' do
|
context 'with pre-calculated hexagon centers' do
|
||||||
let(:pre_calculated_centers) do
|
let(:pre_calculated_centers) do
|
||||||
{
|
[
|
||||||
'8a1fb46622dffff' => [5, 1_717_200_000, 1_717_203_600], # count, earliest, latest timestamps
|
['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],
|
['8a1fb46622e7fff', 3, 1_717_210_000, 1_717_213_600],
|
||||||
'8a1fb46632dffff' => [8, 1_717_220_000, 1_717_223_600]
|
['8a1fb46632dffff', 8, 1_717_220_000, 1_717_223_600]
|
||||||
}
|
]
|
||||||
end
|
end
|
||||||
let(:stat) do
|
let(:stat) do
|
||||||
create(:stat, :with_sharing_enabled, user:, year: 2024, month: 6, h3_hex_ids: pre_calculated_centers)
|
create(:stat, :with_sharing_enabled, user:, year: 2024, month: 6, h3_hex_ids: pre_calculated_centers)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ RSpec.describe Api::PointSerializer do
|
||||||
subject(:serializer) { described_class.new(point).call }
|
subject(:serializer) { described_class.new(point).call }
|
||||||
|
|
||||||
let(:point) { create(:point) }
|
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
|
let(:expected_json) do
|
||||||
point.attributes.except(*all_excluded).tap do |attributes|
|
point.attributes.except(*all_excluded).tap do |attributes|
|
||||||
# API serializer extracts coordinates from PostGIS geometry
|
# API serializer extracts coordinates from PostGIS geometry
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue