#186 adding AffectedThePoem to GanjoorPoemCorrection and some more processing in the api

This commit is contained in:
Hamid Reza Mohammadi 2021-08-13 10:39:56 +04:30
parent 15fcab1464
commit 02e2bf6135
6 changed files with 2864 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class CorrectionsAffectedThePoem : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "AffectedThePoem",
table: "GanjoorPoemCorrections",
type: "bit",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AffectedThePoem",
table: "GanjoorPoemCorrections");
}
}
}

View File

@ -777,6 +777,9 @@ namespace RMuseum.Migrations
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<bool>("AffectedThePoem")
.HasColumnType("bit");
b.Property<int>("ApplicationOrder")
.HasColumnType("int");

View File

@ -108,6 +108,11 @@ namespace RMuseum.Models.Ganjoor
/// review result for rhythm
/// </summary>
public CorrectionReviewResult RhythmResult { get; set; }
/// <summary>
/// had any effect on poem after moderation? effective in history
/// </summary>
public bool AffectedThePoem { get; set; }
}

View File

@ -4894,6 +4894,11 @@
review result for rhythm
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemCorrection.AffectedThePoem">
<summary>
had any effect on poem after moderation? effective in history
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.GanjoorPoet">
<summary>
Ganjoor Poet

View File

@ -1349,7 +1349,8 @@ namespace RMuseum.Services.Implementation
Note = correction.Note,
Date = DateTime.Now,
Result = CorrectionReviewResult.NotReviewed,
Reviewed = false
Reviewed = false,
AffectedThePoem = false
};
_context.GanjoorPoemCorrections.Add(dbCorrection);
await _context.SaveChangesAsync();
@ -1507,8 +1508,10 @@ namespace RMuseum.Services.Implementation
dbCorrection.ReviewerUserId = userId;
dbCorrection.ReviewDate = DateTime.Now;
dbCorrection.ApplicationOrder = 1 + await _context.GanjoorPoemCorrections.Where(c => c.Reviewed).MaxAsync(c => c.ApplicationOrder);
dbCorrection.Reviewed = true;
dbCorrection.AffectedThePoem = false;
if (dbCorrection == null)
return new RServiceResult<GanjoorPoemCorrectionViewModel>(null);
@ -1525,6 +1528,7 @@ namespace RMuseum.Services.Implementation
dbCorrection.ReviewNote = moderation.ReviewNote;
if (dbCorrection.Result == CorrectionReviewResult.Approved)
{
dbCorrection.AffectedThePoem = true;
pageViewModel.Title = moderation.Title;
}
}
@ -1537,6 +1541,7 @@ namespace RMuseum.Services.Implementation
dbCorrection.ReviewNote = moderation.ReviewNote;
if (dbCorrection.RhythmResult == CorrectionReviewResult.Approved)
{
dbCorrection.AffectedThePoem = true;
pageViewModel.Rhythm = moderation.Rhythm;
}
}
@ -1555,6 +1560,7 @@ namespace RMuseum.Services.Implementation
dbVerse.ReviewNote = moderatedVerse.ReviewNote;
if (dbVerse.Result == CorrectionReviewResult.Approved)
{
dbCorrection.AffectedThePoem = true;
poemVerses.Where(v => v.VOrder == moderatedVerse.VORder).Single().Text = moderatedVerse.Text;
}
}