Skip to content

Commit 9c8edad

Browse files
authored
Merge branch 'main' into dependabot/bundler/sqlite3-2.8.0
2 parents 5615e29 + a426d11 commit 9c8edad

16 files changed

Lines changed: 68 additions & 23 deletions

File tree

ATTRIBUTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This project uses the following open source dependencies:
44

5-
Generated on: 2025-12-01
5+
Generated on: 2026-02-09
66
Total dependencies: 151
77

88
## Dependencies by License

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ GEM
116116
bigdecimal (3.3.1)
117117
bindata (2.5.1)
118118
blueprinter (1.2.1)
119-
brakeman (7.1.1)
119+
brakeman (8.0.2)
120120
racc
121121
builder (3.3.0)
122122
capybara (3.40.0)

app/assets/stylesheets/users.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@
88
text-align: center;
99
}
1010
}
11+
12+
.users-list data[value="active"] {
13+
color: #2e7d32;
14+
font-weight: bold;
15+
}
16+
17+
.users-list data[value="inactive"] {
18+
color: #c62828;
19+
}

app/controllers/units_controller.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ def validate_badge_id_param
160160

161161
normalized_id = normalize_unit_id(id_param)
162162
return redirect_to_existing_unit(normalized_id) if unit_exists?(normalized_id)
163-
return redirect_to_invalid_badge unless badge_exists?(normalized_id)
164163

165-
@validated_badge_id = normalized_id
164+
# Only set validated badge ID if it exists, otherwise let model validation handle it
165+
@validated_badge_id = normalized_id if badge_exists?(normalized_id)
166166
end
167167

168168
def log_unit_event(action, unit, details = nil, changed_data = nil)
@@ -383,11 +383,6 @@ def redirect_to_existing_unit(normalized_id)
383383
redirect_to Unit.find(normalized_id)
384384
end
385385

386-
def redirect_to_invalid_badge
387-
flash[:alert] = I18n.t("units.validations.invalid_badge_id")
388-
redirect_to units_path
389-
end
390-
391386
def log_resource_event(action, unit, details, changed_data)
392387
Event.log(
393388
user: current_user,

app/helpers/users_helper.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,17 @@ def format_job_time(time)
2020
return "Never" unless time
2121
"#{time_ago_in_words(time)} ago"
2222
end
23+
24+
sig { params(user: User).returns(String) }
25+
def user_activity_indicator(user)
26+
if user.is_active?
27+
days = (Date.current - user.created_at.to_date).to_i
28+
label = I18n.t("users.status.active", days:)
29+
tag.data(label, value: "active")
30+
else
31+
days = (Date.current - user.active_until).to_i
32+
label = I18n.t("users.status.inactive", days:)
33+
tag.data(label, value: "inactive")
34+
end
35+
end
2336
end

app/models/inspection.rb

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,23 @@ def complete?
225225

226226
sig { returns(T::Hash[Symbol, T.class_of(ApplicationRecord)]) }
227227
def assessment_types
228-
case
229-
when pat_testable? then PAT_TESTABLE_ASSESSMENT_TYPES
230-
when bouncing_pillow? then PILLOW_ASSESSMENT_TYPES
231-
else CASTLE_ASSESSMENT_TYPES
228+
if pat_testable?
229+
PAT_TESTABLE_ASSESSMENT_TYPES
230+
elsif bouncing_pillow?
231+
PILLOW_ASSESSMENT_TYPES
232+
else
233+
CASTLE_ASSESSMENT_TYPES
232234
end
233235
end
234236

235237
sig { returns(T::Hash[Symbol, T.class_of(ApplicationRecord)]) }
236238
def applicable_assessments
237-
case
238-
when pat_testable? then pat_testable_applicable_assessments
239-
when bouncing_pillow? then pillow_applicable_assessments
240-
else castle_applicable_assessments
239+
if pat_testable?
240+
pat_testable_applicable_assessments
241+
elsif bouncing_pillow?
242+
pillow_applicable_assessments
243+
else
244+
castle_applicable_assessments
241245
end
242246
end
243247

@@ -420,7 +424,7 @@ def inspection_tab_incomplete_fields
420424
fields = REQUIRED_TO_COMPLETE_FIELDS - [:passed]
421425

422426
# PAT testable only needs inspection_date
423-
fields = fields & [:inspection_date] if pat_testable?
427+
fields &= [:inspection_date] if pat_testable?
424428

425429
fields
426430
.reject { |f| f.end_with?("_comment") }

app/models/unit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def badge_id_valid
241241
# Check if badge exists
242242
unless Badge.exists?(id: id)
243243
error_msg = I18n.t("units.validations.invalid_badge_id")
244-
errors.add(:id, error_msg)
244+
errors.add(:base, error_msg)
245245
end
246246
end
247247
end

app/views/shared/_save_message.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<% if message_type == "error" %>
99
<div class="error" id="<%= local_assigns[:dom_id] || 'form_save_message' %>">
10-
<%= message_text || t('shared.messages.save_failed') %>
10+
<strong><%= message_text || t('shared.messages.save_failed') %></strong>
1111
<% if local_assigns[:errors].present? %>
1212
<ul>
1313
<% local_assigns[:errors].each do |error| %>

app/views/users/index.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<!-- Header row -->
77
<div class="table-list-header">
88
<%= render 'shared/table_column', field: :email, model: :user_edit, header: true %>
9+
<%= render 'shared/table_column', field: :status, model: :user_edit, header: true %>
910
<%= render 'shared/table_column', field: :admin, model: :user_edit, header: true %>
1011
<%= render 'shared/table_column', field: :registered, model: :user_edit, header: true %>
1112
<%= render 'shared/table_column', field: :last_active, model: :user_edit, header: true %>
@@ -20,6 +21,9 @@
2021
<%= render 'shared/table_column', field: :email, model: :user_edit do %>
2122
<%= user.email %>
2223
<% end %>
24+
<%= render 'shared/table_column', field: :status, model: :user_edit do %>
25+
<%= user_activity_indicator(user) %>
26+
<% end %>
2327
<%= render 'shared/table_column', field: :admin, model: :user_edit do %>
2428
<%= user.admin? ? t('shared.yes') : t('shared.no') %>
2529
<% end %>

attributions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"generated_at": "2025-12-01T03:47:38",
2+
"generated_at": "2026-02-09T04:24:14",
33
"total_dependencies": 151,
44
"dependencies": [
55
{

0 commit comments

Comments
 (0)