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

Add Provider partnerships to training partners #4842

Merged
merged 6 commits into from
Jan 23, 2025

Conversation

inulty-dfe
Copy link
Contributor

@inulty-dfe inulty-dfe commented Jan 22, 2025

Context

Accredited provider users can inspect their training partners in the Publish UI.
The list of Training providers is populated via the accredited providers ratifying of courses.

Changes proposed in this pull request

  • URL changes from /training-providers to /training-partners
  • AddCourseButton updated to work with provider partnerships
  • AddCourseButtonEnrichments can be deleted when we migrate

Guidance to review

Course ratification has not been implemented yet so we cannot set an accredited partner to be the ratifying provider for a course yet.

The review app has provider partnerships enabled.

Training partners

image

Training partners courses

image

Trello

https://trello.com/c/kA22cSN0/393-add-providerpartnerships-to-training-partners

@inulty-dfe inulty-dfe force-pushed the im/add-provider-partnerships-to-training-partners branch 2 times, most recently from 67c7509 to c07bc99 Compare January 22, 2025 12:29
@inulty-dfe inulty-dfe force-pushed the im/add-provider-partnerships-to-training-partners branch from c07bc99 to d1ecd43 Compare January 22, 2025 13:03
@inulty-dfe inulty-dfe force-pushed the im/add-provider-partnerships-to-training-partners branch from 84c8a43 to 1e75af8 Compare January 22, 2025 14:43
@inulty-dfe inulty-dfe added the deploy A Review App will be created for PRs with this label label Jan 22, 2025
@inulty-dfe inulty-dfe marked this pull request as ready for review January 22, 2025 15:05
@inulty-dfe inulty-dfe requested a review from a team as a code owner January 22, 2025 15:05
incomplete_sections_hash.keys.select { |section| send(section) }.map do |section|
Section.new(name: "add #{incomplete_section_article(section)} #{incomplete_section_label_suffix(section)}", path: incomplete_sections_hash[section])
end
end
Copy link
Contributor

@tomas-stefano tomas-stefano Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify by going direct on the view?

<li>
  <%= govuk_link_to(add_school_text, school_path) %>
  <%= govuk_link_to(add_accredited_partner, add_accredited_partner_path) %>
</li>

Then the component will be more simple to read and understand.

Or another alternative to use functional?

def incomplete_sections
   conditions = {
      school: -> { provider.sites.empty? },
      accredited_partner: -> { !(provider.accredited_provider? || provider.accredited_partners.any?) }
    }

    conditions
      .select { |_key, predicate| predicate.call }
      .map { |key, _| build_section(key) }
  end

  private

  def build_section(key)
    Section.new(
      name: I18n.t("incomplete_sections.#{key}.name"),
      path: send("#{key}_path")
    )
  end
  
  def school_path
    ...
  end

   def accredited_partner_path
  ....
   end

Copy link
Contributor Author

@inulty-dfe inulty-dfe Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomas-stefano I've made a change to the AddCourseButton. Tell me if you're happy enough to proceed

I Changed the partnerships version to AddCourseButton from AddCourseButtonPartnerships. And changed the one we'll delete later from AddCourseButton to AddCourseButtonEnrichments.
I've also simplified the logic in the component dramatically, I think.

@inulty-dfe inulty-dfe force-pushed the im/add-provider-partnerships-to-training-partners branch 4 times, most recently from 44cc9fe to a3d0787 Compare January 23, 2025 10:19
def accredited_provider_present?
return true if accredited_provider?

provider.accredited_providers.any?
Copy link
Contributor

@tomas-stefano tomas-stefano Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
provider.accredited_providers.any?
accredited_provider? || provider.accredited_providers.any?

def accredited_provider_not_present?
return false if provider.accredited?

!accredited_provider_present?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting deleted after the switch to provider partnerships

Copy link
Contributor

@tomas-stefano tomas-stefano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor non blocking comments but all good to me

@inulty-dfe inulty-dfe force-pushed the im/add-provider-partnerships-to-training-partners branch from a3d0787 to ce5c77a Compare January 23, 2025 11:06
@inulty-dfe inulty-dfe force-pushed the im/add-provider-partnerships-to-training-partners branch 2 times, most recently from 1daed7d to b8d8eca Compare January 23, 2025 11:34
@inulty-dfe inulty-dfe merged commit af3264b into main Jan 23, 2025
19 checks passed
@inulty-dfe inulty-dfe deleted the im/add-provider-partnerships-to-training-partners branch January 23, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy A Review App will be created for PRs with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants