From 5d09191c1bb8a308a32586dd608dbad0f3d551d9 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 8 Feb 2022 19:56:07 -0600 Subject: [PATCH 1/7] Movie module - show rom region, if not null --- TASVideos/Extensions/EntityExtensions.cs | 3 ++- .../Models/PublicationDisplayModel.cs | 1 + TASVideos/Pages/Shared/_MovieModule.cshtml | 22 ++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/TASVideos/Extensions/EntityExtensions.cs b/TASVideos/Extensions/EntityExtensions.cs index d0c591e8e..fd82e6725 100644 --- a/TASVideos/Extensions/EntityExtensions.cs +++ b/TASVideos/Extensions/EntityExtensions.cs @@ -181,7 +181,8 @@ public static IQueryable ToViewModel(this IQueryable !pr.Publication!.Authors.Select(a => a.UserId).Contains(pr.UserId)) .Where(pr => pr.User!.UseRatings) - .Average(pr => pr.Value) + .Average(pr => pr.Value), + Region = p.Rom != null ? p.Rom.Region : null }); if (ratingSort) diff --git a/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs b/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs index f739700bd..c1becc92e 100644 --- a/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs +++ b/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs @@ -35,6 +35,7 @@ public class PublicationDisplayModel public int RatingCount { get; set; } public double? OverallRating { get; set; } + public string? Region { get; set; } public class TagModel { diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index ec1a95bd9..945dc8199 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -14,6 +14,24 @@ var publicationAwards = await _awards.ForPublication(Model.Id); } +@functions{ + static string RegionDisplay(string? region) + { + if (string.IsNullOrWhiteSpace(region)) + { + return ""; + } + + return region switch + { + "J" => "(JPN)", + "E" => "(Europe)", + "EU" => "(USA/Europe)", + _ => "" + }; + } +} +
@@ -32,7 +50,9 @@ }

- @Model.Title + + @RegionDisplay(Model.Region) @Model.Title +

From a8c4fba557051f2e5057315982b3e1fce9490557 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 9 Feb 2022 19:48:33 -0600 Subject: [PATCH 2/7] Japan not JPN --- TASVideos/Pages/Shared/_MovieModule.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index 945dc8199..754b40058 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -24,7 +24,7 @@ return region switch { - "J" => "(JPN)", + "J" => "(Japan)", "E" => "(Europe)", "EU" => "(USA/Europe)", _ => "" From 5ddf76e4cd60083911b5d15ed01ac02280c77f56 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 9 Feb 2022 20:17:51 -0600 Subject: [PATCH 3/7] show rom version too --- TASVideos/Extensions/EntityExtensions.cs | 3 ++- .../Publications/Models/PublicationDisplayModel.cs | 1 + TASVideos/Pages/Shared/_MovieModule.cshtml | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/TASVideos/Extensions/EntityExtensions.cs b/TASVideos/Extensions/EntityExtensions.cs index fd82e6725..0d032ca28 100644 --- a/TASVideos/Extensions/EntityExtensions.cs +++ b/TASVideos/Extensions/EntityExtensions.cs @@ -182,7 +182,8 @@ public static IQueryable ToViewModel(this IQueryable !pr.Publication!.Authors.Select(a => a.UserId).Contains(pr.UserId)) .Where(pr => pr.User!.UseRatings) .Average(pr => pr.Value), - Region = p.Rom != null ? p.Rom.Region : null + Region = p.Rom != null ? p.Rom.Region : null, + RomVersion = p.Rom != null ? p.Rom.Version : null }); if (ratingSort) diff --git a/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs b/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs index c1becc92e..e284b168c 100644 --- a/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs +++ b/TASVideos/Pages/Publications/Models/PublicationDisplayModel.cs @@ -36,6 +36,7 @@ public class PublicationDisplayModel public int RatingCount { get; set; } public double? OverallRating { get; set; } public string? Region { get; set; } + public string? RomVersion { get; set; } public class TagModel { diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index 754b40058..728e1ce90 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -15,6 +15,13 @@ } @functions{ + static string VersionDisplay(string? version) + { + return string.IsNullOrWhiteSpace(version) + ? "" + : $"v{version}"; + } + static string RegionDisplay(string? region) { if (string.IsNullOrWhiteSpace(region)) @@ -51,7 +58,9 @@

- @RegionDisplay(Model.Region) @Model.Title + @RegionDisplay(Model.Region) + (@VersionDisplay(Model.RomVersion)) + @Model.Title

From cb8fad2439bbb95bbbd9dbbd88f4b28dd1c7872f Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 10 Feb 2022 10:19:28 -0600 Subject: [PATCH 4/7] don't put a v --- TASVideos/Pages/Shared/_MovieModule.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index 728e1ce90..7a47b9d46 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -19,7 +19,7 @@ { return string.IsNullOrWhiteSpace(version) ? "" - : $"v{version}"; + : version; } static string RegionDisplay(string? region) From 60cf10db15284e7a4757571fe3112fbe6980e6a4 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 10 Feb 2022 11:40:16 -0600 Subject: [PATCH 5/7] asdf --- TASVideos/Pages/Shared/_MovieModule.cshtml | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index 7a47b9d46..6b34518f6 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -15,11 +15,19 @@ } @functions{ - static string VersionDisplay(string? version) + static string RomAndVersionDisplay(string? version, string? region) { - return string.IsNullOrWhiteSpace(version) - ? "" - : version; + if (string.IsNullOrWhiteSpace(version) && string.IsNullOrWhiteSpace(region)) + { + return ""; + } + + if (string.IsNullOrWhiteSpace(region)) + { + return version ?? ""; + } + + return $"{RegionDisplay(region)}, {version}"; } static string RegionDisplay(string? region) @@ -31,9 +39,9 @@ return region switch { - "J" => "(Japan)", - "E" => "(Europe)", - "EU" => "(USA/Europe)", + "J" => "Japan", + "E" => "Europe", + "EU" => "USA/Europe", _ => "" }; } @@ -58,8 +66,10 @@

- @RegionDisplay(Model.Region) - (@VersionDisplay(Model.RomVersion)) + @{ + var regionAndVersion = RomAndVersionDisplay(Model.RomVersion, Model.Region); + } + (@regionAndVersion) @Model.Title

From e949b479bcdd00b5bb9931962e947c00929aa653 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 10 Feb 2022 11:44:00 -0600 Subject: [PATCH 6/7] having fun yet? --- TASVideos/Pages/Shared/_MovieModule.cshtml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index 6b34518f6..faec1b63b 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -27,6 +27,11 @@ return version ?? ""; } + if (string.IsNullOrWhiteSpace(version)) + { + return RegionDisplay(region); + } + return $"{RegionDisplay(region)}, {version}"; } From d1ab1478375d8903b480dd2694e4dc4311e4cfaa Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 10 Feb 2022 11:51:55 -0600 Subject: [PATCH 7/7] account for more things that could go wrong --- TASVideos/Pages/Shared/_MovieModule.cshtml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TASVideos/Pages/Shared/_MovieModule.cshtml b/TASVideos/Pages/Shared/_MovieModule.cshtml index faec1b63b..550001e70 100644 --- a/TASVideos/Pages/Shared/_MovieModule.cshtml +++ b/TASVideos/Pages/Shared/_MovieModule.cshtml @@ -17,22 +17,23 @@ @functions{ static string RomAndVersionDisplay(string? version, string? region) { - if (string.IsNullOrWhiteSpace(version) && string.IsNullOrWhiteSpace(region)) + string regionDisplay = RegionDisplay(region); + if (string.IsNullOrWhiteSpace(version) && string.IsNullOrWhiteSpace(regionDisplay)) { return ""; } - if (string.IsNullOrWhiteSpace(region)) + if (string.IsNullOrWhiteSpace(regionDisplay)) { return version ?? ""; } if (string.IsNullOrWhiteSpace(version)) { - return RegionDisplay(region); + return regionDisplay; } - return $"{RegionDisplay(region)}, {version}"; + return $"{regionDisplay}, {version}"; } static string RegionDisplay(string? region)