6772312ea7
The primary license of the project is changing to: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later with some specific files to be licensed under the one of two licenses: CC0-1.0 LGPL-3.0-or-later This commit is one of the many steps to relicense the entire codebase. Documentation granting permission for this relicensing (from all past contributors who hold copyrights) is on file with Software Freedom Conservancy, Inc.
18 lines
No EOL
667 B
Ruby
18 lines
No EOL
667 B
Ruby
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
module MaintainTicketRecords
|
|
|
|
# a function for taking every ticket record with a card and creating a token
|
|
# if the event was in the last two weeks
|
|
def self.tokenize_cards_already_on_tickets
|
|
Qx.transaction do
|
|
event_ids = Event.where('end_datetime >= ?', Time.current-2.weeks).pluck(:id)
|
|
|
|
t = Ticket.includes(:card).includes(:event).where('card_id IS NOT NULL and event_id IN (?)', event_ids)
|
|
t.each{|i|
|
|
token = InsertSourceToken.create_record(i.card, {event: i.event})
|
|
i.source_token = token
|
|
i.save!
|
|
}
|
|
end
|
|
end
|
|
end |