Skip to content

Commit

Permalink
EES-5656 Remove ManageContentPageViewModel.PublicationViewModel.Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
benoutram committed Dec 19, 2024
1 parent 5adfaca commit e6a4d96
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,6 @@ public MappingProfiles()
Title = rv.Publication.Title,
Slug = rv.Publication.Slug,
Contact = rv.Publication.Contact,
Releases = rv.Publication.ReleaseVersions
.FindAll(otherReleaseVersion => rv.Id != otherReleaseVersion.Id &&
IsLatestVersionOfRelease(rv.Publication.ReleaseVersions, otherReleaseVersion.Id))
.OrderByDescending(otherReleaseVersion => otherReleaseVersion.Year)
.ThenByDescending(otherReleaseVersion => otherReleaseVersion.TimePeriodCoverage)
.Select(otherReleaseVersion => new PreviousReleaseViewModel
{
Id = otherReleaseVersion.Id,
Slug = otherReleaseVersion.Slug,
Title = otherReleaseVersion.Title,
})
.ToList(),
ReleaseSeries = new List<ReleaseSeriesItemViewModel>(), // Must be hydrated after mapping
ExternalMethodology = rv.Publication.ExternalMethodology != null
? new ExternalMethodology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ public class PublicationViewModel

public string Slug { get; set; }

public List<PreviousReleaseViewModel> Releases { get; set; }

public List<ReleaseSeriesItemViewModel> ReleaseSeries { get; set; }

public Contact Contact { get; set; }
Expand All @@ -100,13 +98,4 @@ public class ReleaseNoteViewModel

public DateTime On { get; set; }
}

public class PreviousReleaseViewModel
{
public Guid Id { get; set; }

public string Slug { get; set; }

public string Title { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ describe('ReleaseContentPage', () => {
id: 'publication-id',
title: 'Publication 1',
slug: 'publication-1',
releases: [],
releaseSeries: [],
theme: { id: 'theme-1', title: 'Theme 1' },
contact: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ describe('PreReleaseContentPage', () => {
id: 'publication-id',
title: 'Publication 1',
slug: 'publication-1',
releases: [],
releaseSeries: [],
theme: { id: 'theme-1', title: 'Theme 1' },
contact: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ const prototypeReleaseContent: ReleaseContent = {
slug: 'methodology-slug',
},
],
releases: [
{
id: 'previous-release-id',
slug: 'previous-release-slug',
title: 'Previous release title',
},
],
releaseSeries: [],
slug: 'publication-slug',
title: 'Initial Teacher Training Census',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const defaultPublication: Publication = {
slug: 'methodology-slug',
},
],
releases: [],
releaseSeries: [
{
isLegacyLink: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export interface Publication {
id: string;
slug: string;
title: string;
releases: {
id: string;
slug: string;
title: string;
}[];
releaseSeries: ReleaseSeriesItem[];
theme: {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ const PublicationReleasePage: NextPage<Props> = ({ release }) => {
>
View latest data:{' '}
<span className="govuk-!-font-weight-bold">
{release.publication.releases[0].title}
{
release.publication.releaseSeries.find(
rsi => !rsi.isLegacyLink,
)?.description
}
</span>
</Link>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,16 +342,6 @@ describe('PublicationReleasePage', () => {
month: 2,
year: 2022,
},
publication: {
...testRelease.publication,
releases: [
{
id: 'latest-release',
title: 'Latest Release Title',
slug: 'latest-release-slug',
},
],
},
}}
/>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ export const testPublication: Publication = {
id: 'publication-1',
title: 'Pupil absence in schools in England',
slug: 'pupil-absence-in-schools-in-england',
releases: [
{
id: 'release-2',
slug: '2018-19',
title: 'Academic year 2018/19',
},
{
id: 'release-1',
slug: '2017-18',
title: 'Academic year 2017/18',
},
],
releaseSeries: [
{
isLegacyLink: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ export const testPublicationRelease: Release = {
id: '',
slug: '',
title: '',
releases: [],
releaseSeries: [],
theme: {
title: '',
Expand Down

0 comments on commit e6a4d96

Please sign in to comment.