Fix minor nits: drop bundle exec, share interval options
Remove bundle exec from Dockerfile CMD — gems are global in the
image so rackup runs directly.

Add Views::INTERVAL_OPTIONS derived from the model constant and
use it in all three forms instead of hardcoding the option list.

Assisted-by: Claude Opus 4.6 via pi
change lropvowotmrnonnkzpklswszsopswlxr
commit 69819523b74b09443de2965c86924640f2cd2a84
author Alpha Chen <alpha@kejadlen.dev>
date
parent xuyytqyr
diff --git a/Dockerfile b/Dockerfile
index 6a22be3..a604e74 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,4 +25,4 @@ COPY --from=build /app /app
 
 EXPOSE 9292
 
-CMD ["bundle", "exec", "rackup", "-o", "0.0.0.0"]
+CMD ["rackup", "-o", "0.0.0.0"]
diff --git a/lib/ketchup/views/dashboard.rb b/lib/ketchup/views/dashboard.rb
index 14710bb..a933b00 100644
--- a/lib/ketchup/views/dashboard.rb
+++ b/lib/ketchup/views/dashboard.rb
@@ -5,6 +5,8 @@ require "phlex"
 require_relative "layout"
 
 module Views
+  INTERVAL_OPTIONS = Series::INTERVAL_UNITS.map { |u| [u, "#{u}(s)"] }.freeze
+
   class Dashboard < Phlex::HTML
     def initialize(current_user:, series: nil)
       @current_user = current_user
@@ -106,11 +108,7 @@ module Views
                 "x-model": "unit",
                 "x-on:change": "save()"
               ) do
-                option(value: "day") { "day(s)" }
-                option(value: "week") { "week(s)" }
-                option(value: "month") { "month(s)" }
-                option(value: "quarter") { "quarter(s)" }
-                option(value: "year") { "year(s)" }
+                INTERVAL_OPTIONS.each { |val, label| option(value: val) { label } }
               end
             end
 
@@ -192,11 +190,7 @@ module Views
                 min: 1, value: 1, required: true
               )
               select(name: "interval_unit", class: "detail-input detail-input-unit", required: true) do
-                option(value: "day", selected: true) { "day(s)" }
-                option(value: "week") { "week(s)" }
-                option(value: "month") { "month(s)" }
-                option(value: "quarter") { "quarter(s)" }
-                option(value: "year") { "year(s)" }
+                INTERVAL_OPTIONS.each_with_index { |(val, label), i| option(value: val, selected: i == 0) { label } }
               end
             end
 
diff --git a/lib/ketchup/views/series/new.rb b/lib/ketchup/views/series/new.rb
index acbb61e..87b103a 100644
--- a/lib/ketchup/views/series/new.rb
+++ b/lib/ketchup/views/series/new.rb
@@ -30,11 +30,7 @@ module Views
                     min: 1, value: 1, required: true
                   )
                   select(id: "interval_unit", name: "interval_unit", required: true) do
-                    option(value: "day") { "day(s)" }
-                    option(value: "week") { "week(s)" }
-                    option(value: "month") { "month(s)" }
-                    option(value: "quarter") { "quarter(s)" }
-                    option(value: "year") { "year(s)" }
+                    Views::INTERVAL_OPTIONS.each { |val, label| option(value: val) { label } }
                   end
                 end
               end