Exemple #1
0
        private async Task DoExport(CourseExporter exporter, Course course, CourseExportOptions options, bool isInitialExport)
        {
            var process = await stepikRepo.AddExportProcess(course.Id, options.StepikCourseId, User.Identity.GetUserId(), isInitialExport);

            CourseExportResults exportResults;

            if (isInitialExport)
            {
                exportResults = await exporter.InitialExportCourse(course, (CourseInitialExportOptions)options);
            }
            else
            {
                exportResults = await exporter.UpdateCourse(course, (CourseUpdateOptions)options);
            }
            process.StepikCourseTitle = exportResults.StepikCourseTitle;

            await UpdateMapInfoAboutExportedSlides(course, exportResults);

            await stepikRepo.MarkExportProcessAsFinished(process, exportResults.Exception == null, (exportResults.Exception?.ToString() ?? "") + exportResults.Log);

            await notificationsRepo.AddNotification(course.Id, new CourseExportedToStepikNotification { ProcessId = process.Id }, usersRepo.GetUlearnBotUserId());
        }
Exemple #2
0
 public async Task TestExportCourseFromDirectory(string coursePath)
 {
     var courseLoader = new CourseLoader();
     var stubCourse   = courseLoader.Load(new DirectoryInfo(coursePath));
     await courseExporter.InitialExportCourse(stubCourse, new CourseInitialExportOptions(stepikCourseId, stepikXQueueName, new List <Guid>()));
 }