Skip to content

Commit

Permalink
Added changes to CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhian authored and rhian-cs committed May 31, 2023
1 parent e0d4a86 commit c107b60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## HEAD

## v2.1.0
* 31.05.2023: Add a new endpoint (/sidekiq/api/statistic_by_last_job_status.json) *Rhian Moraes*
* 31.05.2023: /sidekiq/statistic: add two checkboxes to show/hide workers based on their last job status (#113) *Rhian Moraes*

## v2.0.0

#### BREAK
Expand Down
12 changes: 5 additions & 7 deletions lib/sidekiq/statistic/statistic/workers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ def display
end

def display_by_last_status
{
passed: filter_last_job_status('passed'),
failed: filter_last_job_status('failed')
}
end
filtered_workers = display.group_by {|worker| worker[:last_job_status] }

filtered_workers['passed'] ||= []
filtered_workers['failed'] ||= []

def filter_last_job_status(status)
display.select { |worker| worker[:last_job_status] == status }
filtered_workers.transform_keys(&:to_sym)
end

def display_per_day(worker_name)
Expand Down
11 changes: 0 additions & 11 deletions test/test_sidekiq/statistic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,6 @@ module Statistic
end
end

describe "#filter_last_job_status" do
it 'return array with worker when filtering by passed workers' do
middlewared {}

subject = statistic.filter_last_job_status('passed')

_(subject).must_be_instance_of Array
assert_equal subject[0][:name], worker
end
end

describe '#display_per_day' do
it 'return workers job per day' do
middlewared {}
Expand Down

0 comments on commit c107b60

Please sign in to comment.