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

akonhilas/APPEALS-34880 #19947

Merged
merged 6 commits into from
Nov 14, 2023
Merged
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
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
ThorntonMatthew marked this conversation as resolved.
Show resolved Hide resolved
},
"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
Loading