Skip to content

Commit

Permalink
Allow zero values when testing for good?
Browse files Browse the repository at this point in the history
- FIXED: Allow value of 0 to be considered a good result when testing for good values
  • Loading branch information
ttscoff committed Jul 1, 2023
1 parent 1c2da9a commit 64fd4bf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
doing (2.1.81)
doing (2.1.82)
chronic (~> 0.10, >= 0.10.2)
deep_merge (~> 1.2, >= 1.2.1)
gli (~> 2.20, >= 2.20.1)
Expand Down Expand Up @@ -40,17 +40,17 @@ GEM
rdoc (6.3.3)
redcarpet (3.6.0)
rexml (3.2.5)
rouge (4.1.0)
rouge (4.1.2)
safe_yaml (1.0.5)
strings (0.2.1)
strings-ansi (~> 0.2)
unicode-display_width (>= 1.5, < 3.0)
unicode_utils (~> 1.4)
strings-ansi (0.2.0)
temple (0.10.0)
temple (0.10.2)
test-unit (3.4.9)
power_assert
tilt (2.1.0)
tilt (2.2.0)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-link (0.1.1)
Expand Down
22 changes: 11 additions & 11 deletions bin/commands/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
when /^all$/i
section = 'All'
args.shift
when /^(choose|pick)$/i
when /^(choose|pick|menu)$/i
section = @wwid.choose_section(include_all: true)

args.shift
Expand Down Expand Up @@ -98,11 +98,11 @@
end
end
else
if options[:section] && !options[:section].empty?
section = @wwid.guess_section(options[:section]) || 'All'
else
section = options[:menu] ? @wwid.choose_section(include_all: true) : Doing.setting('current_section')
end
section = if options[:section] && !options[:section].empty?
@wwid.guess_section(options[:section]) || 'All'
else
options[:menu] ? @wwid.choose_section(include_all: true) : Doing.setting('current_section')
end
section ||= 'All'
end

Expand All @@ -111,11 +111,11 @@
options[:times] = true if options[:totals]

template = Doing.setting(['templates', options[:config_template]]).deep_merge({
'wrap_width' => Doing.setting('wrap_width') || 0,
'date_format' => Doing.setting('default_date_format'),
'order' => Doing.setting('order')&.normalize_order || :asc,
'tags_color' => Doing.setting('tags_color')
})
'wrap_width' => Doing.setting('wrap_width') || 0,
'date_format' => Doing.setting('default_date_format'),
'order' => Doing.setting('order')&.normalize_order || :asc,
'tags_color' => Doing.setting('tags_color')
})

if options[:search]
search = options[:search]
Expand Down
2 changes: 1 addition & 1 deletion lib/doing/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def initialize(msg, exit_code = 26)

class InvalidPlugin < DoingRuntimeError
def initialize(kind = 'output', msg = nil)
super(%(Invalid #{kind} type (#{msg})), 128, topic: 'Invalid:')
super(%(Invalid #{kind} type (#{msg})), 128, topic: 'Plugin:')
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/doing/good.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Doing
class ::Numeric
# Test of number is positive
def good?
positive?
self >= 0
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/doing/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def remove_empty

def tag_filter_to_options
hsh = dup
if hsh.key?(:tag_filter)
if hsh.key?(:tag_filter) && hsh[:tag_filter]
hsh[:tags] = hsh[:tag_filter][:tags]
hsh[:bool] = hsh[:tag_filter][:bool]
hsh.delete(:tag_filter)
Expand All @@ -173,8 +173,8 @@ def tag_filter_to_options
##
def to_view
hsh = symbolize_keys
%w[x save c a s o h e editor m menu i interactive d delete t fuzzy time_filter sort_tags].each do |key|
hsh.delete(key.to_sym) if hsh.key?(key.to_sym)
%i[x save c a s o h e editor m menu i interactive d delete t fuzzy time_filter sort_tags].each do |key|
hsh.delete(key) if hsh.key?(key)
end

hsh.delete_unless_key(:tag, %i[bool])
Expand Down

0 comments on commit 64fd4bf

Please sign in to comment.