#467 GetNextUnreviewedCatCorrectionAsync
This commit is contained in:
parent
3ceb0a5383
commit
cd13295eed
@ -20634,6 +20634,14 @@
|
|||||||
<param name="id"></param>
|
<param name="id"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetNextUnreviewedCatCorrectionAsync(System.Int32,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
get next unreviewed cat correction
|
||||||
|
</summary>
|
||||||
|
<param name="skip"></param>
|
||||||
|
<param name="onlyUserCorrections"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="P:RMuseum.Services.Implementation.GanjoorService.AggressiveCacheEnabled">
|
<member name="P:RMuseum.Services.Implementation.GanjoorService.AggressiveCacheEnabled">
|
||||||
<summary>
|
<summary>
|
||||||
aggressive cache
|
aggressive cache
|
||||||
|
|||||||
@ -4115,6 +4115,51 @@ namespace RMuseum.Services.Implementation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get next unreviewed cat correction
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skip"></param>
|
||||||
|
/// <param name="onlyUserCorrections"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<RServiceResult<GanjoorCatCorrectionViewModel>> GetNextUnreviewedCatCorrectionAsync(int skip, bool onlyUserCorrections)
|
||||||
|
{
|
||||||
|
string systemEmail = $"{Configuration.GetSection("Ganjoor")["SystemEmail"]}";
|
||||||
|
var systemUser = await _appUserService.FindUserByEmail(systemEmail);
|
||||||
|
var systemUserId = systemUser.Result == null ? Guid.Empty : (Guid)systemUser.Result.Id;
|
||||||
|
|
||||||
|
var dbCorrection = await _context.GanjoorCatCorrections.AsNoTracking().Include(c => c.User)
|
||||||
|
.Where(c => c.Reviewed == false && (onlyUserCorrections == false || c.UserId != systemUserId))
|
||||||
|
.OrderBy(c => c.Id)
|
||||||
|
.Skip(skip)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (dbCorrection == null)
|
||||||
|
return new RServiceResult<GanjoorCatCorrectionViewModel>(null);
|
||||||
|
|
||||||
|
return new RServiceResult<GanjoorCatCorrectionViewModel>
|
||||||
|
(
|
||||||
|
new GanjoorCatCorrectionViewModel()
|
||||||
|
{
|
||||||
|
Id = dbCorrection.Id,
|
||||||
|
CatId = dbCorrection.CatId,
|
||||||
|
UserId = dbCorrection.UserId,
|
||||||
|
Description = dbCorrection.Description,
|
||||||
|
DescriptionHtml = dbCorrection.DescriptionHtml,
|
||||||
|
OriginalDescription = dbCorrection.OriginalDescription,
|
||||||
|
OriginalDescriptionHtml = dbCorrection.OriginalDescriptionHtml,
|
||||||
|
Note = dbCorrection.Note,
|
||||||
|
Date = dbCorrection.Date,
|
||||||
|
Reviewed = dbCorrection.Reviewed,
|
||||||
|
Result = dbCorrection.Result,
|
||||||
|
ReviewNote = dbCorrection.ReviewNote,
|
||||||
|
ReviewDate = dbCorrection.ReviewDate,
|
||||||
|
UserNickname = dbCorrection.HideMyName && dbCorrection.Reviewed ? "" : string.IsNullOrEmpty(dbCorrection.User.NickName) ? dbCorrection.User.Id.ToString() : dbCorrection.User.NickName,
|
||||||
|
HideMyName = dbCorrection.HideMyName,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// aggressive cache
|
/// aggressive cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user