Class: ShipmentStatusHistoryDAO
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ShipmentStatusHistoryDAO
- Defined in:
- lib/shipping_backup_client/models/shipment_status_history_dao.rb
Overview
Schema Information
Table name: shipment_status_histories
id :integer not null, primary key
shipment_id :integer not null
old_status :string(255)
location :string(255)
remarks :string(255)
created_at :datetime
updated_at :datetime
new_status :string(255)
status_type :string(255)
status_date :datetime
updated_by :string(255)
Defined Under Namespace
Modules: StatusTypes
Class Method Summary collapse
- .build_shipment_status_history_object(old_status, new_status, location, remarks, status_date = Time.now) ⇒ Object
- .from_date(from_date) ⇒ Object
- .to_date(to_date) ⇒ Object
Class Method Details
.build_shipment_status_history_object(old_status, new_status, location, remarks, status_date = Time.now) ⇒ Object
38 39 40 41 |
# File 'lib/shipping_backup_client/models/shipment_status_history_dao.rb', line 38 def self.build_shipment_status_history_object(old_status,new_status,location,remarks,status_date=Time.now) facility_display_name = Fkl::Client::LogisticsClient.get_facility_from_name(location).try(:display_name) if location.present? ShipmentStatusHistoryDAO.new(:old_status => old_status,:new_status => new_status, :location => facility_display_name, :remarks => remarks, :status_type => StatusTypes::SHIPMENT, :status_date => status_date || Time.now) end |
.from_date(from_date) ⇒ Object
44 45 46 47 |
# File 'lib/shipping_backup_client/models/shipment_status_history_dao.rb', line 44 def self.from_date(from_date) from_date = DateTime.parse(from_date).strftime("%Y-%m-%d %H:%M:%S") if from_date from_date ? where("shipment_status_histories.status_date >= '#{from_date}'") : ShipmentStatusHistoryDAO.scoped end |
.to_date(to_date) ⇒ Object
49 50 51 52 |
# File 'lib/shipping_backup_client/models/shipment_status_history_dao.rb', line 49 def self.to_date(to_date) to_date = DateTime.parse(to_date).strftime("%Y-%m-%d %H:%M:%S") if to_date to_date ? where("shipment_status_histories.status_date < '#{to_date}' + interval 1 day") : ShipmentStatusHistoryDAO.scoped end |