From f5a63af7eb5930de0c577a68f7752638b3ee449d Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sun, 12 Feb 2023 21:49:07 +0330 Subject: [PATCH] docs: #363 bug fix --- GanjooRazor/Areas/User/Pages/Section.cshtml | 13 ++++++++++--- GanjooRazor/Areas/User/Pages/Section.cshtml.cs | 9 +++++++-- .../GanjoorService-ModerateSectionCorrection.cs | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/GanjooRazor/Areas/User/Pages/Section.cshtml b/GanjooRazor/Areas/User/Pages/Section.cshtml index 1e470c12..d4562397 100644 --- a/GanjooRazor/Areas/User/Pages/Section.cshtml +++ b/GanjooRazor/Areas/User/Pages/Section.cshtml @@ -62,7 +62,12 @@ else rhyme_letters = null; } - if (breakFromVIndices.length == 0 && rhythm_new == null && rhyme_letters == null) { + var section_lang = $('#language').val(); + if (section_lang == $('#language-old').text()) { + section_lang = null; + } + + if (breakFromVIndices.length == 0 && rhythm_new == null && rhyme_letters == null && section_lang == null) { alert('شما هیچ تغییری در متن نداده‌اید!'); return; } @@ -81,7 +86,8 @@ else rhythm: rhythm_new, rhyme: rhyme_letters, breakFromVIndices: breakFromVIndices, - note: $('#note').val() + note: $('#note').val(), + lang: section_lang }, success: function () { @@ -345,7 +351,8 @@ else -

@Model.LanguageNameFromCode(Model.PoemSection.Language)

+ @Model.LanguageNameFromCode(Model.PoemSection.Language) +
@Model.PoemSection.Language
diff --git a/GanjooRazor/Areas/User/Pages/Section.cshtml.cs b/GanjooRazor/Areas/User/Pages/Section.cshtml.cs index a9950d9c..fc14caf0 100644 --- a/GanjooRazor/Areas/User/Pages/Section.cshtml.cs +++ b/GanjooRazor/Areas/User/Pages/Section.cshtml.cs @@ -154,6 +154,10 @@ namespace GanjooRazor.Areas.User.Pages RhythmsAlphabetically = rhythmsByVerseCount.ToArray(); PoemSection = PageInformation.Poem.Sections.Where(s => s.Index == int.Parse(Request.Query["index"])).Single(); + if(string.IsNullOrEmpty(PoemSection.Language)) + { + PoemSection.Language = "fa-IR"; + } int index = Array.IndexOf(PageInformation.Poem.Sections, PoemSection); if(index > 0) @@ -183,7 +187,7 @@ namespace GanjooRazor.Areas.User.Pages return Page(); } - public async Task OnPostSendSectionCorrectionsAsync(int sectionId, string rhythm, string rhyme, int[] breakFromVIndices, string note) + public async Task OnPostSendSectionCorrectionsAsync(int sectionId, string rhythm, string rhyme, int[] breakFromVIndices, string note, string lang) { using (HttpClient secureClient = new HttpClient()) { @@ -300,7 +304,8 @@ namespace GanjooRazor.Areas.User.Pages BreakFromVerse8VOrder = breakFromVerse8VOrder, BreakFromVerse9VOrder = breakFromVerse9VOrder, BreakFromVerse10VOrder = breakFromVerse10VOrder, - Note = note + Note = note, + Language = lang, }; HttpResponseMessage response = await secureClient.PostAsync( diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModerateSectionCorrection.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModerateSectionCorrection.cs index 13175013..0479ae1d 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModerateSectionCorrection.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModerateSectionCorrection.cs @@ -883,6 +883,8 @@ namespace RMuseum.Services.Implementation Date = DateTime.Now, Reviewed = false, AffectedThePoem = false, + Language = correction.Language, + LanguageReviewResult = CorrectionReviewResult.NotReviewed, }; _context.GanjoorPoemSectionCorrections.Add(dbCorrection); await _context.SaveChangesAsync();