Skip to content

Commit

Permalink
Fixed missing select box options.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcwatson11 committed Feb 3, 2025
1 parent a6f871c commit 7ea8964
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/jobs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def new
@job = Job.new
@event_options = get_event_options
@job_status = 'created'
@job_type = 'LS_EXTRACT'
@start_date_default = Date.today.last_week(:thursday)
@end_date_default = @start_date_default + 4.days
end
Expand All @@ -44,6 +45,7 @@ def new
def edit
@job = Job.find(params[:id])
@job_status = @job.status
@job_type = @job.type
@start_date_default = @job.start_date
@end_date_default = @job.end_date
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ class Job < ApplicationRecord
self.inheritance_column = nil
has_many :logs, foreign_key: "jobs_id", class_name: "AppLog", dependent: :destroy
enum :status, [:created, :processing, :error, :complete, :paused], prefix: true, default: :created
TYPE = ['WOO_IMPORT', 'LS_IMPORT', 'SF_IMPORT', 'WOO_REFRESH', 'POLL_SHEET']
TYPE = ['WOO_IMPORT', 'LS_EXTRACT', 'LS_IMPORT', 'SF_IMPORT', 'WOO_REFRESH', 'POLL_SHEET']
STATUS = ['created', 'processing', 'error', 'complete', 'paused']
end
6 changes: 6 additions & 0 deletions app/views/jobs/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<% end %>
</div>
</div>
<div class="form-group mb-3">
<%= form.label :type, "Type", class: "form-label", for: 'type' %>
<div class="d-flex gap-2">
<%= form.select :type, options_for_select(Job::TYPE, @job_type), {required: true}, {class: "form-select"} %>
</div>
</div>
<div class="form-group mb-3">
<%= form.label :status, "Status", class: "form-label", for: 'status' %>
<div class="d-flex gap-2">
Expand Down

0 comments on commit 7ea8964

Please sign in to comment.