Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B_reed/APPEALS-65696-v2 #23621

Merged
merged 19 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
CI: true
REDIS_URL_CACHE: redis://redis:6379/0/cache/
TEST_VACOLS_HOST: facols_db
HEADLESS: true

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion app/models/hearings/transcription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Transcription < CaseflowRecord
belongs_to :transcription_contractor
has_many :transcription_files, class_name: "TranscriptionFile"
belongs_to :transcription_package, foreign_key: :task_number, primary_key: :task_number
before_create :sequence_task_id
before_validation :sequence_task_id

validates :hearing_type, inclusion: { in: %w[Hearing LegacyHearing] }
validates :hearing, presence: true
Expand Down
16 changes: 7 additions & 9 deletions app/services/hearings/transcription_sequence_id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,30 @@
# This file defines a Ruby function that mimics the functionality of the PL/SQL trigger.
# It's not a direct translation, but provides a similar behavior for managing task IDs.

# Define a constant to represent the system generated tag.
SYSTEM_GEN_TAG = User.system_user.id

# Define a class to represent the transcriptions table.
class Hearings::TranscriptionSequenceId
attr_accessor :created_by_id, :task_id
attr_accessor :created_by_id, :task_id, :transcription_status

# Initialize a new transcription object.
def initialize(created_by_id, task_id = nil)
@created_by_id = created_by_id
@task_id = task_id
@transcription_status = "unassigned"
end

# Simulate the trigger execution.
def before_insert_on_transcriptions(transcription)
# Set the transcription status to "unassigned"
transcription.transcription_status = "unassigned"
# Call the trigger function to update the task ID.
trg_myseq(transcription)
end

# Define a function to simulate the trigger behavior.
def trg_myseq(transcription)
# Check if the transcription was created by the system.
if transcription.created_by_id == SYSTEM_GEN_TAG
# Generate a new task ID if the transcription was created by the system.
transcription.task_id = next_task_id
end
# Generate a new task ID if the transcription was created by the system.
transcription.task_id = next_task_id
# Return the updated transcription object.
transcription.task_id
end
Expand All @@ -40,7 +38,7 @@ def next_task_id
# This implementation simply returns an incremented value.
@task_id ||= 0
# Switch this value back to 1 after testing
@task_id += 5000
@task_id += 1

@task_id
end
Expand Down
Loading
Loading