Skip to content

Commit

Permalink
Merge pull request #19947 from department-of-veterans-affairs/akonhil…
Browse files Browse the repository at this point in the history
…as/APPEALS-34880

akonhilas/APPEALS-34880
  • Loading branch information
ThorntonMatthew authored Nov 14, 2023
2 parents a565e51 + 3cc4037 commit e01a021
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/models/hearing_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ def subject_for_conference
"Guest Link for #{scheduled_for.strftime('%b %e, %Y')}"
end

def nbf
scheduled_for.beginning_of_day.to_i
end

def exp
scheduled_for.end_of_day.to_i
end

private

# called through the 'before_destroy' callback on the hearing_day object.
Expand Down
8 changes: 8 additions & 0 deletions app/models/hearings/virtual_hearing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,14 @@ def subject_for_conference
"#{appeal.docket_number}_#{appeal.id}_#{appeal.class}"
end

def nbf
hearing.scheduled_for.beginning_of_day.to_i
end

def exp
hearing.scheduled_for.end_of_day.to_i
end

private

def assign_created_by_user
Expand Down
4 changes: 2 additions & 2 deletions app/services/external_api/webex_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def create_conference(virtual_hearing)
body = {
"jwt": {
"sub": virtual_hearing.subject_for_conference,
"Nbf": virtual_hearing.hearing.scheduled_for.beginning_of_day.to_i,
"Exp": virtual_hearing.hearing.scheduled_for.end_of_day.to_i
"Nbf": virtual_hearing.nbf,
"Exp": virtual_hearing.exp
},
"aud": @aud,
"numGuest": 1,
Expand Down
16 changes: 16 additions & 0 deletions spec/models/hearing_day_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,22 @@ def format_begins_at_from_db(time_string, scheduled_for)
it "returns the expected meeting conference details" do
is_expected.to eq("Guest Link for #{expected_date}")
end

context "nbf and exp" do
subject { hearing_day.nbf }

it "returns correct nbf" do
expect subject == 1_695_254_400
end

before do
subject { hearing_day.exp }
end

it "returns correct exp" do
expect subject == 1_695_340_799
end
end
end

context "hearing day in the future, conference link doesnt exist" do
Expand Down
21 changes: 19 additions & 2 deletions spec/models/hearings/virtual_hearing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,9 @@ def link(name)
end
let(:virtual_hearing) { create(:virtual_hearing, hearing: hearing) }

subject { virtual_hearing.subject_for_conference }

context "For an AMA Hearing" do
let(:hearing) { create(:hearing, hearing_day: hearing_day) }
subject { virtual_hearing.subject_for_conference }

it "returns the expected meeting conference details" do
is_expected.to eq(
Expand All @@ -456,12 +455,30 @@ def link(name)

context "For a Legacy Hearing" do
let(:hearing) { create(:legacy_hearing, hearing_day: hearing_day) }
subject { virtual_hearing.subject_for_conference }

it "returns the expected meeting conference details" do
is_expected.to eq(
"#{hearing.appeal.docket_number}_#{hearing.appeal.id}_LegacyAppeal"
)
end
end

context "nbf and exp" do
let(:hearing) { create(:hearing, hearing_day: hearing_day) }
subject { virtual_hearing.nbf }

it "returns correct nbf" do
expect subject == 1_695_355_200
end

before do
subject { virtual_hearing.exp }
end

it "returns correct exp" do
expect subject == 1_695_427_199
end
end
end
end

0 comments on commit e01a021

Please sign in to comment.