Skip to content

Commit

Permalink
Merge branch 'nanego:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
B-Rass authored Dec 4, 2024
2 parents 88c896c + 59fd67d commit 428de69
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/controllers/external_app_records_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class ExternalAppRecordsController < ApplicationController
def index
@external_app_records = ExternalAppRecord.includes(server: :frame).order("servers.name")
@external_app_records_count = @external_app_records.count
@filter = ProcessorFilter.new(@external_app_records, params)
@external_app_records = @filter.results
@servers_count = Server.no_pdus.count
Expand Down
4 changes: 2 additions & 2 deletions app/processors/external_app_records_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class ExternalAppRecordsProcessor < ApplicationProcessor

match :external_serial_status, fail_when_no_matches: true do
having "found" do
raw.where.not(external_serial: nil)
raw.where.not(external_serial: nil).where.not(external_serial: "")
end

having "not_found" do
raw.where(external_serial: nil)
raw.where(external_serial: nil).or(raw.where(external_serial: ""))
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/external_app_records/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
method: :put %>
<% end %>

<p class="mb-0">Listés : <%= @pagy.count %> sur <%= @servers_count %> machines connues </p>
<p class="mb-0">Listés : <%= @external_app_records_count %> sur <%= @servers_count %> machines connues </p>
<% end %>

<div class="p-4 border-top d-flex flex-column row-gap-4">
Expand Down
2 changes: 1 addition & 1 deletion app/views/sites/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
icon: "pencil",
size: :sm,
is_responsive: true,
extra_classes: "btn-outline-dark") %>
extra_classes: "btn-info") %>
<% end %>
<% end %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions spec/processors/external_app_records_processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
context "with external_serial_status = not_found" do
let(:params) { { external_serial_status: "not_found" } }

it { expect(result.size).to eq(1) }
it { is_expected.to include(external_app_records(:one)) }
it { expect(result.size).to eq(2) }
it { is_expected.to contain_exactly(external_app_records(:one), external_app_records(:three)) }
end
end

Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/external_app_records.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ one:
two:
server_id: 2
external_serial: "serial"

three:
server_id: 3
external_serial: ""

0 comments on commit 428de69

Please sign in to comment.