Example #1
0
        private static ReviewInfo ToReviewInfo(ExerciseCodeReview r, bool isUlearnBot,
                                               [CanBeNull] Dictionary <int, IEnumerable <ExerciseCodeReviewComment> > reviewId2Comments)
        {
            var comments = reviewId2Comments?.GetValueOrDefault(r.Id);

            return(ReviewInfo.Build(r, comments, isUlearnBot));
        }
Example #2
0
 public static ReviewInfo Build(ExerciseCodeReview r, [CanBeNull] IEnumerable <ExerciseCodeReviewComment> comments, bool isUlearnBot)
 {
     return(new ReviewInfo
     {
         Id = r.Id,
         Comment = r.Comment,
         RenderedComment = CommentTextHelper.RenderCommentTextToHtml(r.Comment),
         Author = isUlearnBot ? null : BaseController.BuildShortUserInfo(r.Author),
         AddingTime = isUlearnBot || r.AddingTime <= DateTime.UnixEpoch ? (DateTime?)null : r.AddingTime,
         FinishLine = r.FinishLine,
         FinishPosition = r.FinishPosition,
         StartLine = r.StartLine,
         StartPosition = r.StartPosition,
         Comments = comments
                    .EmptyIfNull()
                    .OrderBy(c => c.AddingTime)
                    .Select(ReviewCommentResponse.Build)
                    .ToList()
     });
 }
Example #3
0
 public async Task UpdateExerciseCodeReview(ExerciseCodeReview review, string newComment)
 {
     review.Comment = newComment;
     await db.SaveChangesAsync().ConfigureAwait(false);
 }
Example #4
0
 public async Task DeleteExerciseCodeReview(ExerciseCodeReview review)
 {
     review.IsDeleted = true;
     await db.SaveChangesAsync().ConfigureAwait(false);
 }
 public async Task DeleteExerciseCodeReview(ExerciseCodeReview review)
 {
     review.IsDeleted = true;
     await db.SaveChangesAsync();
 }
Example #6
0
 public Task UpdateExerciseCodeReview(ExerciseCodeReview review, string newComment)
 {
     review.Comment = newComment;
     return(db.SaveChangesAsync());
 }
Example #7
0
 public Task DeleteExerciseCodeReview(ExerciseCodeReview review)
 {
     review.IsDeleted = true;
     return(db.SaveChangesAsync());
 }