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 #23618

Draft
wants to merge 14 commits into
base: feature/APPEALS-49620
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
69 changes: 69 additions & 0 deletions client/app/components/DatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import SearchableDropdown from '../components/SearchableDropdown';
import Button from '../components/Button';
import COPY from '../../COPY';
import moment from 'moment-timezone';
<<<<<<< HEAD
=======
import DateSelector from './DateSelector';
>>>>>>> origin/feature/APPEALS-49620

const datePickerStyle = css({
paddingLeft: '0.95rem',
Expand Down Expand Up @@ -68,6 +71,8 @@ const menuStyle = css({
}
});

<<<<<<< HEAD
=======
const defaultOptions = [
{ value: 'between', label: COPY.DATE_PICKER_DROPDOWN_BETWEEN },
{ value: 'before', label: COPY.DATE_PICKER_DROPDOWN_BEFORE },
Expand All @@ -82,6 +87,7 @@ const additionalOptions = [
{ value: 'all', label: COPY.DATE_PICKER_DROPDOWN_ALL }
];

>>>>>>> origin/feature/APPEALS-49620
/* Custom filter method to pass in a QueueTable column object */
/* This is called for every row of data in the table */
/* rowValue is a date string such as '5/15/2024' */
Expand Down Expand Up @@ -115,6 +121,8 @@ export const datePickerFilterValue = (rowValue, filterValues) => {
const endDate = moment(`${filterOptions[1]} 23:59:59`).valueOf();

pick = rowDate >= startDate && rowDate <= endDate;
<<<<<<< HEAD
=======
} else if (mode === 'last7') {
const startDate = moment().subtract(7, 'days').
valueOf();
Expand All @@ -133,6 +141,7 @@ export const datePickerFilterValue = (rowValue, filterValues) => {
const endDate = moment().valueOf();

pick = rowDate >= startDate && rowDate <= endDate;
>>>>>>> origin/feature/APPEALS-49620
}
}
}
Expand All @@ -147,7 +156,10 @@ class DatePicker extends React.PureComponent {
const position = (props.settings && props.settings.position) || 'left';
const buttons = (props.settings && props.settings.buttons) || false;
const selected = (props.selected && props.selected) || false;
<<<<<<< HEAD
=======
const noFutureDates = (props.settings && props.settings.noFutureDates) || false;
>>>>>>> origin/feature/APPEALS-49620

this.state = {
open: false,
Expand All @@ -156,21 +168,28 @@ class DatePicker extends React.PureComponent {
endDate: '',
position,
buttons,
<<<<<<< HEAD
selected
=======
selected,
noFutureDates
>>>>>>> origin/feature/APPEALS-49620
};
}

apply() {
const { onChange } = this.props;

<<<<<<< HEAD
=======
if (this.state.mode === 'all') {
this.clearFilter();
this.hideDropdown();

return true;
}

>>>>>>> origin/feature/APPEALS-49620
if (onChange) {
onChange(`${this.state.mode },${ this.state.startDate },${ this.state.endDate}`);
}
Expand Down Expand Up @@ -221,6 +240,8 @@ class DatePicker extends React.PureComponent {
return this.state.open || this.state.selected;
}

<<<<<<< HEAD
=======
isDateInFuture = (date) => {
if (!date) {
return false;
Expand All @@ -229,10 +250,14 @@ class DatePicker extends React.PureComponent {
return Boolean(Date.parse(date) > Date.now());
}

>>>>>>> origin/feature/APPEALS-49620
buttonDisabled = () => {
let disabled = true;

if (this.state.mode === 'between') {
<<<<<<< HEAD
disabled = this.state.startDate === '' || this.state.endDate === '';
=======
if (this.state.startDate === '' || this.state.endDate === '') {
disabled = true;
} else if (this.state.noFutureDates &&
Expand All @@ -249,6 +274,7 @@ class DatePicker extends React.PureComponent {
disabled = true;
} else if (this.state.mode === 'all') {
disabled = false;
>>>>>>> origin/feature/APPEALS-49620
} else if (this.state.mode !== '') {
disabled = this.state.startDate === '';
}
Expand All @@ -269,12 +295,17 @@ class DatePicker extends React.PureComponent {
}

updateMode = (mode) => {
<<<<<<< HEAD
=======
const format = 'YYYY-MM-DD';

>>>>>>> origin/feature/APPEALS-49620
this.setState({ mode });
if (mode !== 'between') {
this.setState({ endDate: '' });
}
<<<<<<< HEAD
=======

if (mode === 'last7') {
this.setState({ startDate: moment().subtract(7, 'days').
Expand All @@ -286,6 +317,7 @@ class DatePicker extends React.PureComponent {
this.setState({ startDate: moment().subtract(365, 'days').
format(format) });
}
>>>>>>> origin/feature/APPEALS-49620
}

quickButtons = (option) => {
Expand All @@ -309,6 +341,9 @@ class DatePicker extends React.PureComponent {
this.hideDropdown();
}

<<<<<<< HEAD
render() {
=======
getOptions = () => {
if (this.props.settings?.additionalOptions) {
const options = defaultOptions.concat(additionalOptions);
Expand Down Expand Up @@ -346,6 +381,7 @@ class DatePicker extends React.PureComponent {

render() {

>>>>>>> origin/feature/APPEALS-49620
return <span {...datePickerStyle} ref={(rootElem) => {
this.rootElem = rootElem;
}}>
Expand All @@ -371,13 +407,35 @@ class DatePicker extends React.PureComponent {
<div className="input-wrapper">
<SearchableDropdown
name={COPY.DATE_PICKER_DROPDOWN_LABEL}
<<<<<<< HEAD
options={[
{ value: 'between', label: COPY.DATE_PICKER_DROPDOWN_BETWEEN },
{ value: 'before', label: COPY.DATE_PICKER_DROPDOWN_BEFORE },
{ value: 'after', label: COPY.DATE_PICKER_DROPDOWN_AFTER },
{ value: 'on', label: COPY.DATE_PICKER_DROPDOWN_ON }
]}
=======
options={this.getOptions()}
>>>>>>> origin/feature/APPEALS-49620
searchable
onChange={(option) => this.updateMode(option.value)}
filterOption={() => true}
value={this.state.mode} />
</div>

<<<<<<< HEAD
{this.state.mode !== '' &&
<div className="input-wrapper">
<label aria-label="start-date"
htmlFor="start-date">
{this.state.mode === 'between' ? COPY.DATE_PICKER_FROM : COPY.DATE_PICKER_DATE}</label>
<input
id="start-date"
name="start-date"
defaultValue={this.state.startDate}
type="date"
onChange={(event) => this.setState({ startDate: event.target.value })}
=======
{additionalOptions.some((option) => option.value === this.state.mode) ?
null :
<div className="input-wrapper">
Expand All @@ -390,12 +448,22 @@ class DatePicker extends React.PureComponent {
errorMessage={this.startDateErrorMessage()}
onChange={(value) => this.setState({ startDate: value })}
type="date"
>>>>>>> origin/feature/APPEALS-49620
/>
</div>
}

{this.state.mode === 'between' &&
<div className="input-wrapper">
<<<<<<< HEAD
<label aria-label="end-date" htmlFor="end-date">{COPY.DATE_PICKER_TO}</label>
<input
id="end-date"
name="end-date"
defaultValue={this.state.endDate}
type="date"
onChange={(event) => this.setState({ endDate: event.target.value })}
=======
<DateSelector
label={COPY.DATE_PICKER_TO}
name="end-date"
Expand All @@ -405,6 +473,7 @@ class DatePicker extends React.PureComponent {
errorMessage={this.endDateErrorMessage()}
onChange={(value) => this.setState({ endDate: value })}
type="date"
>>>>>>> origin/feature/APPEALS-49620
/>
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ export const workOrderColumn = () => {
</Link>
</div>
),
backendCanSort: true,
getSortValue: (row) => row.workOrder,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ describe('TranscriptionDetailsInputs', () => {
const transcriptionContractors = {
1: 'Genesis Government Solutions, Inc.',
2: 'Jamison Professional Services',
3: 'The Ravens Group, Inc.',
4: 'Vet Reporting'
3: 'The Ravens Group, Inc.'
};

it('renders correctly', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ const mockTranscriptionPackages = [
items: 15,
dateSent: '01/01/2024',
expectedReturnDate: '01/15/2024',
contractor: 'Vet Reporting',
contractor: 'Genesis Government Solutions, Inc.',
status: 'Sent',
},
{
Expand Down Expand Up @@ -422,7 +422,7 @@ const mockTranscriptionPackages = [
items: 14,
dateSent: '01/12/2024',
expectedReturnDate: '01/27/2024',
contractor: 'Vet Reporting',
contractor: 'The Ravens Group, Inc.',
status: 'Sent',
},
{
Expand Down
Loading
Loading