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

Movie module - Show RomHash Region, if not null #1090

Merged
merged 7 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion TASVideos/Extensions/EntityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ public static IQueryable<PublicationDisplayModel> ToViewModel(this IQueryable<Pu
OverallRating = p.PublicationRatings
.Where(pr => !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,
RomVersion = p.Rom != null ? p.Rom.Version : null
});

if (ratingSort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ 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
{
Expand Down
31 changes: 30 additions & 1 deletion TASVideos/Pages/Shared/_MovieModule.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@
var publicationAwards = await _awards.ForPublication(Model.Id);
}

@functions{
static string VersionDisplay(string? version)
{
return string.IsNullOrWhiteSpace(version)
? ""
: $"v{version}";
Masterjun3 marked this conversation as resolved.
Show resolved Hide resolved
}

static string RegionDisplay(string? region)
{
if (string.IsNullOrWhiteSpace(region))
{
return "";
}

return region switch
{
"J" => "(Japan)",
"E" => "(Europe)",
"EU" => "(USA/Europe)",
_ => ""
};
}
}

<card class="border border-primary">
<cardheader class="bg-cardprimary p-2">
<div class="gx-3 clearfix">
Expand All @@ -32,7 +57,11 @@
}
</div>
<h4>
<a asp-page="/Publications/View" asp-route-id="@Model.Id" class="text-decoration-none"><span class="text-dark">@Model.Title </span></a>
<a asp-page="/Publications/View" asp-route-id="@Model.Id" class="text-decoration-none"><span class="text-dark">
<small condition="!string.IsNullOrWhiteSpace(Model.Region)">@RegionDisplay(Model.Region)</small>
<small condition="!string.IsNullOrWhiteSpace(Model.RomVersion)"> (@VersionDisplay(Model.RomVersion))</small>
@Model.Title
</span></a>
</h4>
</div>
</cardheader>
Expand Down