diff --git a/.env.defaults b/.env.defaults index 613a2dbb08..6fe8dfab14 100644 --- a/.env.defaults +++ b/.env.defaults @@ -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 diff --git a/.env.test b/.env.test index 7a4ec60ab9..7dc3fe7fca 100644 --- a/.env.test +++ b/.env.test @@ -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 diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 885ffb01e2..285951eefb 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -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) diff --git a/app/presenters/live_booking_presenter.rb b/app/presenters/live_booking_presenter.rb index 1e42ce6a58..20948393c2 100644 --- a/app/presenters/live_booking_presenter.rb +++ b/app/presenters/live_booking_presenter.rb @@ -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) diff --git a/app/presenters/online_booking_presenter.rb b/app/presenters/online_booking_presenter.rb index fb16b48db0..8f762f0f03 100644 --- a/app/presenters/online_booking_presenter.rb +++ b/app/presenters/online_booking_presenter.rb @@ -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) diff --git a/app/views/courses/_aside-booking.html.erb b/app/views/courses/_aside-booking.html.erb index 1c83ac64d8..87eb7bb24b 100644 --- a/app/views/courses/_aside-booking.html.erb +++ b/app/views/courses/_aside-booking.html.erb @@ -20,29 +20,30 @@ <%= @booking.address(occurrence) %> <% 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 + ) %> <% else %>
<%= 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 + ) %>
<%= render('start-date', date: @start_date) if (@start_date && !@started) %> <% end %> diff --git a/config/application.rb b/config/application.rb index 4ea9b3abba..da028d0f8c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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" diff --git a/spec/helpers/courses_helper_spec.rb b/spec/helpers/courses_helper_spec.rb index 679e3fe63f..b23de60139 100644 --- a/spec/helpers/courses_helper_spec.rb +++ b/spec/helpers/courses_helper_spec.rb @@ -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 diff --git a/spec/presenters/live_booking_presenter_spec.rb b/spec/presenters/live_booking_presenter_spec.rb index a1081878fc..1f35d84768 100644 --- a/spec/presenters/live_booking_presenter_spec.rb +++ b/spec/presenters/live_booking_presenter_spec.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/views/courses/_aside-booking.html_spec.rb b/spec/views/courses/_aside-booking.html_spec.rb index 1369d4138b..06fc14541a 100644 --- a/spec/views/courses/_aside-booking.html_spec.rb +++ b/spec/views/courses/_aside-booking.html_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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