Skip to content
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 .env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ STEM_OAUTH_SITE=https://ncce-www-stage-int.stem.org.uk
STEM_ACCOUNT_SITE="preprod-account.stem.org.uk"
STEM_AUTH0_DOMAIN=user-profile-preprod.uk.auth0.com
STEM_COURSE_REDIRECT=https://ncce-www-stage-int.stem.org.uk
STEM_CPD_STORE_REDIRECT=https://cpd.stem.org.uk/

MANDRILL_SMTP_USERNAME=username
MANDRILL_API_KEY=key
Expand Down
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ STEM_ACCOUNT_SITE="preprod-account.stem.org.uk"
STEM_COURSE_REDIRECT=https://ncce-www-stage-int.stem.org.uk
STEM_AUTH0_DOMAIN=user-profile-preprod.uk.auth0.com

STEM_CPD_STORE_REDIRECT=https://cpd.stem.org.uk

CURRICULUM_TEST_SCHEMA_PATH='spec/support/curriculum/curriculum_schema.json'
CURRICULUM_APP_URL=https://staging-curriculum.teachcomputing.org
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/courses_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def max_fee(fees)
"£#{sorted_fees[0].fee}"
end

def stem_course_link(course_template_no)
"#{Rails.application.config.stem_course_redirect}/cpdredirect/#{course_template_no}"
def stem_course_link(course_activity_code)
"#{Rails.application.config.stem_course_redirect}/app/#{course_activity_code}"
end

def stripped_summary(string)
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/live_booking_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def course_button(occurrences, course_template_no)
)
end

def booking_path(occurrence_id)
"#{Rails.application.config.stem_course_redirect}/cpdredirect/#{occurrence_id}"
def booking_path(stem_activity_code)
"#{Rails.application.config.stem_course_redirect}/app/#{stem_activity_code}"
end

def address(occurrence)
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/online_booking_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def completed_button_introduction
"You will be taken to the MyLearning platform for further details."
end

def booking_path(stem_course_id)
"#{Rails.application.config.stem_course_redirect}/cpdredirect/#{stem_course_id}"
def booking_path(stem_activity_code)
"#{Rails.application.config.stem_course_redirect}/app/#{stem_activity_code}"
end

def show_stem_occurrence_list(always_on)
Expand Down
31 changes: 16 additions & 15 deletions app/views/courses/_aside-booking.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,30 @@
<%= @booking.address(occurrence) %>
</span>
<span class='ncce-booking-list__button_wrapper'>
<%= link_to(
@booking.booking_button_title,
@booking.booking_path(occurrence.course_occurrence_no),
class: 'govuk-button button',
draggable: 'false',
data: { event_action: 'click', event_category: 'course details', event_label: 'join course' },
target: :_blank
) %>

</span>
</div>
</li>
<% end %>
<%= link_to(
@booking.authenticated_title,
@booking.booking_path(@activity.stem_activity_code),
class: 'govuk-button button--aside govuk-!-margin-top-4',
draggable: 'false',
data: { event_action: 'click', event_category: 'course details', event_label: 'join online course' },
target: :_blank
) %>
</ul>
<% else %>
<p class="govuk-body">
<%= link_to(
@booking.authenticated_title,
@booking.booking_path(@activity.stem_course_template_no),
class: 'govuk-button button--aside',
draggable: 'false',
data: { event_action: 'click', event_category: 'course details', event_label: 'join online course' },
target: :_blank
) %>
@booking.authenticated_title,
@booking.booking_path(@activity.stem_activity_code),
class: 'govuk-button button--aside',
draggable: 'false',
data: { event_action: 'click', event_category: 'course details', event_label: 'join online course' },
target: :_blank
) %>
</p>
<%= render('start-date', date: @start_date) if (@start_date && !@started) %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Application < Rails::Application
config.stem_credentials_access_token = ENV["STEM_CREDENTIALS_ACCESS_TOKEN_KEY"]
config.stem_credentials_refresh_token = ENV["STEM_CREDENTIALS_REFRESH_TOKEN_KEY"]

config.stem_course_redirect = ENV["STEM_COURSE_REDIRECT"]
config.stem_course_redirect = ENV["STEM_CPD_STORE_REDIRECT"]

# default is true
config.secure_cookies = ENV["SECURE_COOKIES"] != "off"
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/courses_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

describe("#stem_course_link") do
it "returns the link to the course page on stem.org.uk" do
expect(helper.stem_course_link("01de2624")).to eq "#{ENV.fetch("STEM_COURSE_REDIRECT")}/cpdredirect/01de2624"
expect(helper.stem_course_link("01de2624")).to eq "#{ENV.fetch("STEM_CPD_STORE_REDIRECT")}/app/01de2624"
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/presenters/live_booking_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
it "links to the course booking path" do
expect(
described_class.new.course_button([], "FAKE_COURSE_ID")
).to match(/href="https:\/\/ncce-www-stage-int.stem.org.uk\/cpdredirect\/FAKE_COURSE_ID"/)
).to match(/href="https:\/\/cpd.stem.org.uk\/app\/FAKE_COURSE_ID"/)
end

it 'says "View course"' do
Expand All @@ -84,7 +84,7 @@
it "links to the course booking path" do
expect(
described_class.new.course_button(Array.new(20), "FAKE_COURSE_ID")
).to match(/href="https:\/\/ncce-www-stage-int.stem.org.uk\/cpdredirect\/FAKE_COURSE_ID"/)
).to match(/href="https:\/\/cpd.stem.org.uk\/app\/FAKE_COURSE_ID"/)
end

it 'says "See more dates"' do
Expand All @@ -107,7 +107,7 @@
it "is the full URI of the stem website booking" do
expect(
described_class.new.booking_path("FAKE_COURSE_ID")
).to eq "https://ncce-www-stage-int.stem.org.uk/cpdredirect/FAKE_COURSE_ID"
).to eq "https://cpd.stem.org.uk/app/FAKE_COURSE_ID"
end
end

Expand Down
13 changes: 6 additions & 7 deletions spec/views/courses/_aside-booking.html_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@
)
end

it "renders link to STEM Learning booking page using occurence" do
occurence = occurrences.first
expected_link = "https://ncce-www-stage-int.stem.org.uk/cpdredirect/#{occurence.course_occurrence_no}"
it "renders link to STEM Learning booking page" do
expected_link = "https://cpd.stem.org.uk/app/#{activity.stem_activity_code}"
expect(rendered).to have_link("Join", href: expected_link)
end

Expand Down Expand Up @@ -96,7 +95,7 @@
end

it "renders link to STEM Learning booking page" do
expected_link = "https://ncce-www-stage-int.stem.org.uk/cpdredirect/#{activity.stem_course_template_no}"
expected_link = "https://cpd.stem.org.uk/app/#{activity.stem_activity_code}"
expect(rendered).to have_link("Join this course", href: expected_link)
end

Expand All @@ -114,7 +113,7 @@
end

it "renders link to STEM Learning booking page" do
expected_link = "https://ncce-www-stage-int.stem.org.uk/cpdredirect/#{activity.stem_course_template_no}"
expected_link = "https://cpd.stem.org.uk/app/#{activity.stem_activity_code}"
expect(rendered).to have_link("Join this course", href: expected_link)
end

Expand Down Expand Up @@ -288,7 +287,7 @@

expect(rendered).to have_link(
"Book",
href: "https://ncce-www-stage-int.stem.org.uk/cpdredirect/#{occurrence.course_occurrence_no}"
href: "https://cpd.stem.org.uk/app/#{activity.stem_activity_code}"
)
end
end
Expand Down Expand Up @@ -452,7 +451,7 @@

expect(rendered).to have_link(
"Book",
href: "https://ncce-www-stage-int.stem.org.uk/cpdredirect/#{occurrence.course_occurrence_no}"
href: "https://cpd.stem.org.uk/app/#{activity.stem_activity_code}"
)
end
end
Expand Down