docs: #312 bug fix: Pages with more than one first whole poem sections or having paragraphs have problems in the related poems section

This commit is contained in:
Hamid Reza Mohammadi 2022-05-02 19:53:52 +04:30
parent 8b580a938e
commit eca2bc48f1
2 changed files with 18 additions and 7 deletions

View File

@ -550,6 +550,8 @@ namespace GanjooRazor.Pages
}
}
public bool MutiPartPoemPage { get; set; }
public List<GanjoorPoemSection> SectionsWithRelated { get; set; }
public List<GanjoorPoemSection> SectionsWithMetreAndRhymes { get; set; }
@ -557,15 +559,23 @@ namespace GanjooRazor.Pages
{
SectionsWithRelated = new List<GanjoorPoemSection>();
SectionsWithMetreAndRhymes = new List<GanjoorPoemSection>();
foreach (var section in GanjoorPage.Poem.Sections)
MutiPartPoemPage = GanjoorPage.Poem.Verses.Where(v => v.VersePosition == VersePosition.Paragraph || v.VersePosition == VersePosition.Single).Any()
||
GanjoorPage.Poem.Sections.Count(s => s.SectionType == PoemSectionType.WholePoem && s.VerseType == VersePoemSectionType.First) != 1;
if (
!MutiPartPoemPage
)
{
if(section.Top6RelatedSections.Length > 0)
foreach (var section in GanjoorPage.Poem.Sections)
{
SectionsWithRelated.Add(section);
}
if(section.SectionType == PoemSectionType.WholePoem && section.GanjoorMetre != null && !string.IsNullOrEmpty(section.RhymeLetters))
{
SectionsWithMetreAndRhymes.Add(section);
if (section.Top6RelatedSections.Length > 0)
{
SectionsWithRelated.Add(section);
}
if (section.SectionType == PoemSectionType.WholePoem && section.GanjoorMetre != null && !string.IsNullOrEmpty(section.RhymeLetters))
{
SectionsWithMetreAndRhymes.Add(section);
}
}
}
}

View File

@ -302,6 +302,7 @@
@if (Model.GanjoorPage.Poem.Sections.Where(s => s.SectionType == RMuseum.Models.Ganjoor.PoemSectionType.WholePoem && s.GanjoorMetre != null).Any() || !string.IsNullOrEmpty(Model.GanjoorPage.Poem.OldTag) || !string.IsNullOrEmpty(Model.GanjoorPage.Poem.SourceName))
{
<table>
@if(!Model.MutiPartPoemPage)
@foreach (var s in Model.GanjoorPage.Poem.Sections.Where(s => s.SectionType == RMuseum.Models.Ganjoor.PoemSectionType.WholePoem && s.GanjoorMetre != null).ToList())
{
<tr>