Skip to content

Commit

Permalink
#89 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hrmoh committed Mar 14, 2021
1 parent 799e1e6 commit b48e292
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions RMuseum/Services/Implementation/RecitationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -862,13 +862,17 @@ public async Task<RServiceResult<UploadSession>> FinalizeNewUploadSession(Upload
existing.Mp3FileCheckSum = audio.FileCheckSum;
existing.Mp3SizeInBytes = mp3fileSize;
existing.FileLastUpdated = session.UploadEndTime;
existing.AudioSyncStatus = AudioSyncStatus.SoundOrXMLFilesChanged;
existing.AudioSyncStatus = AudioSyncStatus.SynchronizedOrRejected;
context.Recitations.Update(existing);
await context.SaveChangesAsync();
await PublishNarration(existing);
await new RNotificationService(context).PushNotification
(
existing.OwnerId,
"انتشار نهایی خوانش ارسالی",
$"خوانش ارسالی {existing.AudioTitle} منتشر شد.{Environment.NewLine}" +
$"می‌توانید با مراجعه به <a href=\"https://ganjoor.net/?p={existing.GanjoorPostId}\">این صفحه</a> وضعیت آن را بررسی کنید."
);
}
}
Expand Down Expand Up @@ -1054,7 +1058,18 @@ await _notificationService.PushNotification
}
else //approved:
{
await PublishNarration(narration);

narration.AudioSyncStatus = AudioSyncStatus.SynchronizedOrRejected;
_context.Recitations.Update(narration);
await _context.SaveChangesAsync();

await _notificationService.PushNotification
(
narration.OwnerId,
"انتشار نهایی خوانش ارسالی",
$"خوانش ارسالی {narration.AudioTitle} منتشر شد.{Environment.NewLine}" +
$"می‌توانید با مراجعه به <a href=\"https://ganjoor.net/?p={narration.GanjoorPostId}\">این صفحه</a> وضعیت آن را بررسی کنید."
);
}

return new RServiceResult<RecitationViewModel>(new RecitationViewModel(narration, narration.Owner, await _context.GanjoorPoems.Where(p => p.Id == narration.GanjoorPostId).SingleOrDefaultAsync()));
Expand All @@ -1067,21 +1082,6 @@ await _notificationService.PushNotification


#region Old Remote Update Codes (now contains segments of reusable codes)
private async Task PublishNarration(Recitation narration)
{
narration.AudioSyncStatus = AudioSyncStatus.SynchronizedOrRejected;
_context.Recitations.Update(narration);
await _context.SaveChangesAsync();

await _notificationService.PushNotification
(
narration.OwnerId,
"انتشار نهایی خوانش ارسالی",
$"خوانش ارسالی {narration.AudioTitle} منتشر شد.{Environment.NewLine}" +
$"می‌توانید با مراجعه به <a href=\"https://ganjoor.net/?p={narration.GanjoorPostId}\">این صفحه</a> وضعیت آن را بررسی کنید."
);

}
private async Task UpdateRecitation(Recitation narration, bool notify)
{

Expand Down

0 comments on commit b48e292

Please sign in to comment.