From 6522ab033949cfb37603e25ce88fe82358ee51bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=B6hm?= Date: Sun, 11 Aug 2024 16:53:28 +0200 Subject: [PATCH] Renamed status ready_to_pickup to just pickup --- app/models/job.rb | 10 +++++----- config/tailwind.config.js | 8 ++++---- db/schema.rb | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/models/job.rb b/app/models/job.rb index 9da1b8c..ba68253 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -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 diff --git a/config/tailwind.config.js b/config/tailwind.config.js index 59fd7ca..e928e0b 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -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", diff --git a/db/schema.rb b/db/schema.rb index 0429133..056dc55 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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