Skip to content

Commit

Permalink
Fix pathing an smaller linting (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Flückiger authored May 6, 2021
1 parent d3ef235 commit ba3cbfb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
12 changes: 7 additions & 5 deletions app/services/issue_connector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ def initialize(issues, timer_session)
@errors = []
end

def run
validate_issues
create_connections
end

private

def validate_issues
issues_exist?
end
Expand All @@ -25,11 +32,6 @@ def issues_exist?
@errors.count.zero?
end

def run
validate_issues
create_connections
end

def create_connections
return false unless @errors.count.zero?

Expand Down
5 changes: 5 additions & 0 deletions app/services/settings_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class SettingsManager
DEFAULT_HOUR_FORMAT_PRECISION = 2
DEFAULT_MAX_HOURS_PER_SESSION = 24
DEFAULT_MAX_HOURS_PER_DAY = 24
DEFAULT_VISIBLE_HINTS = true

class << self
def rounding_for_displayed_hours
Expand All @@ -18,6 +19,10 @@ def max_hours_recorded_per_session
settings_object['max_hours_recorded_per_session'] || DEFAULT_MAX_HOURS_PER_SESSION
end

def visible_hints
settings_object['visible_hints'] || DEFAULT_VISIBLE_HINTS
end

def settings_object
Setting['plugin_redmine_tracky']
end
Expand Down
8 changes: 8 additions & 0 deletions app/views/settings/_redmine_tracky_settings.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,13 @@
name="settings[max_hours_recorded_per_session]" >
</td>
</tr>
<tr>
<th><%= t('timer_sessions.settings.displayed_hours_rounding') %></th>
<td>
<input type="number" id="visible_hints"
value="<%= settings['visible_hints'] %>"
name="settings[visible_hints]" >
</td>
</tr>
</tbody>
</table>
5 changes: 2 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

# Plugin's routes
# See: http://guides.rubyonrails.org/routing.htm
resources :timer_sessions, only: %i[index edit update patch destroy] do
get 'time_error', to: 'timer_sessions#time_error', as: :timer_sessions_time_error
end
resources :timer_sessions, only: %i[index edit update patch destroy]

get 'timer_sessions_report', to: 'timer_sessions#report', as: :timer_sessions_report
get 'timer_sessions_time_error/:id', to: 'timer_sessions#time_error', as: :timer_sessions_time_error

post 'time_tracker/start', to: 'time_tracker#start', as: :start_time_tracker
post 'time_tracker/stop', to: 'time_tracker#stop', as: :stop_time_tracker
Expand Down
6 changes: 3 additions & 3 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
default_settings = {
'displayed_hours_rounding' => 2,
'max_hours_recorded_per_day' => 24,
'max_hours_recorded_per_session' => 24
'max_hours_recorded_per_session' => 24,
'visible_hints' => true
}

settings default: default_settings, partial: 'settings/redmine_tracky_settings'
Expand All @@ -35,7 +36,6 @@
caption: 'TimerSessions'

project_module :timer_sessions do

permission :manage_timer_sessions, {
timer_sessions: %i[index create update edit patch destroy report time_error report time_error],
time_tracker: %i[start stop update]
Expand Down Expand Up @@ -63,6 +63,6 @@

permission :delete_timer_sessions,{
timer_sessions: %i[destroy],
},require: :loggedin
}, require: :loggedin
end
end

0 comments on commit ba3cbfb

Please sign in to comment.