diff --git a/app/models/entry.rb b/app/models/entry.rb index 9ed78ac..ab58529 100644 --- a/app/models/entry.rb +++ b/app/models/entry.rb @@ -15,6 +15,15 @@ class Entry < ApplicationRecord def fetch_data!(inline: false) + # TODO: make this more robust, this should not be configured globally. + # Track parliament session dates for matching? + if self.published_at < Time.parse("2025-05-26") + self.skipped_at = Time.now + self.skip_reason = "Too old, published before 2025-05-26 (Carney's election)" + self.save! + return + end + unless inline return EntryDataFetcherJob.perform_later(self) end diff --git a/db/migrate/20250619212356_add_skipped_at_to_entry.rb b/db/migrate/20250619212356_add_skipped_at_to_entry.rb new file mode 100644 index 0000000..cc5a812 --- /dev/null +++ b/db/migrate/20250619212356_add_skipped_at_to_entry.rb @@ -0,0 +1,6 @@ +class AddSkippedAtToEntry < ActiveRecord::Migration[8.0] + def change + add_column :entries, :skipped_at, :timestamp + add_column :entries, :skip_reason, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 63c87c9..94df139 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[8.0].define(version: 2025_06_19_173204) do +ActiveRecord::Schema[8.0].define(version: 2025_06_19_212356) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -96,6 +96,8 @@ t.datetime "activities_extracted_at", precision: nil t.boolean "is_index" t.bigint "parent_id" + t.datetime "skipped_at", precision: nil + t.string "skip_reason" t.index ["feed_id"], name: "index_entries_on_feed_id" t.index ["government_id"], name: "index_entries_on_government_id" t.index ["parent_id"], name: "index_entries_on_parent_id"