Renamed status ready_to_pickup to just pickup
This commit is contained in:
@@ -19,13 +19,13 @@ class Job < ApplicationRecord
|
||||
enum status: {
|
||||
open: 0,
|
||||
printing: 1,
|
||||
ready_for_pickup: 2,
|
||||
pickup: 2,
|
||||
paid: 3,
|
||||
canceled: 4
|
||||
}
|
||||
|
||||
# NOTE: only named status are returned because of WHERE/IN clause for the enum values
|
||||
scope :in_status_order, -> { in_order_of(:status, %w[open printing ready_for_pickup paid canceled]) }
|
||||
scope :in_status_order, -> { in_order_of(:status, %w[open printing pickup paid canceled]) }
|
||||
|
||||
scope :created_today, -> { created_on_day(Time.now) }
|
||||
scope :created_on_day, lambda { |date|
|
||||
@@ -35,12 +35,12 @@ class Job < ApplicationRecord
|
||||
scope :upgraded_on_day, lambda { |date|
|
||||
where("upgraded_at >= ? AND upgraded_at <= ?", date.beginning_of_day, date.end_of_day)
|
||||
}
|
||||
# Returns all jobs with status: open print ready_for_pickup and jobs from today with status: paid canceled
|
||||
# Returns all jobs with status: open print pickup and jobs from today with status: paid canceled
|
||||
# paid: only updated_at today
|
||||
# canceled: only updated_at today
|
||||
def self.currently_working_on
|
||||
# NOTE: use Time.now instead of Date.today to take the timezone into account
|
||||
where(status: %i[open printing ready_for_pickup])
|
||||
where(status: %i[open printing pickup])
|
||||
.or(Job.where(status: %i[paid canceled])
|
||||
.where("status_changed_at >= ?", Time.now.beginning_of_day))
|
||||
# .in_status_order
|
||||
@@ -76,7 +76,7 @@ class Job < ApplicationRecord
|
||||
private
|
||||
|
||||
def update_printed_at
|
||||
self.printed_at = Time.now if ready_for_pickup? || (paid? && printed_at.nil?)
|
||||
self.printed_at = Time.now if pickup? || (paid? && printed_at.nil?)
|
||||
end
|
||||
|
||||
def update_paid_at
|
||||
|
||||
@@ -23,8 +23,8 @@ module.exports = {
|
||||
"status-open-light": "#d1d5db", // gray-300
|
||||
"status-printing": "#713f12", // yellow-900
|
||||
"status-printing-light": "#fde047", // yellow-300
|
||||
"status-ready_for_pickup": "#365314", // lime-900
|
||||
"status-ready_for_pickup-light": "#bef264", // lime-300
|
||||
"status-pickup": "#365314", // lime-900
|
||||
"status-pickup-light": "#bef264", // lime-300
|
||||
"status-paid": "#14532d", // green-900
|
||||
"status-paid-light": "#86efac", // green-300
|
||||
"status-canceled": "#7f1d1d", // red-900
|
||||
@@ -37,8 +37,8 @@ module.exports = {
|
||||
"bg-status-open-light",
|
||||
"text-status-printing",
|
||||
"bg-status-printing-light",
|
||||
"text-status-ready_for_pickup",
|
||||
"bg-status-ready_for_pickup-light",
|
||||
"text-status-pickup",
|
||||
"bg-status-pickup-light",
|
||||
"text-status-paid",
|
||||
"bg-status-paid-light",
|
||||
"text-status-canceled",
|
||||
|
||||
2
db/schema.rb
generated
2
db/schema.rb
generated
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_08_10_095256) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2024_08_01_153403) do
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
|
||||
Reference in New Issue
Block a user