示例#1
0
 public GroupMembersRepo(UlearnDb db, IManualCheckingsForOldSolutionsAdder manualCheckingsForOldSolutionsAdder, IGroupsRepo groupsRepo, ILogger logger)
 {
     this.db = db;
     this.manualCheckingsForOldSolutionsAdder = manualCheckingsForOldSolutionsAdder;
     this.groupsRepo = groupsRepo;
     this.logger     = logger;
 }
示例#2
0
        public void SetUp()
        {
            SetupTestInfrastructureAsync(services => services.AddScoped <GroupsController>()).GetAwaiter().GetResult();

            groupsController = GetController <GroupsController>();
            groupsRepo       = serviceProvider.GetService <IGroupsRepo>();
        }
示例#3
0
 public JoinGroupController(ILogger logger, WebCourseManager courseManager, UlearnDb db,
                            IUsersRepo usersRepo,
                            IGroupsRepo groupsRepo, IGroupMembersRepo groupMembersRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.groupsRepo       = groupsRepo;
     this.groupMembersRepo = groupMembersRepo;
 }
示例#4
0
 public GroupsController(IWebCourseManager courseManager, UlearnDb db,
                         IUsersRepo usersRepo,
                         IGroupsRepo groupsRepo, IGroupAccessesRepo groupAccessesRepo, IGroupMembersRepo groupMembersRepo)
     : base(courseManager, db, usersRepo)
 {
     this.groupsRepo        = groupsRepo;
     this.groupAccessesRepo = groupAccessesRepo;
     this.groupMembersRepo  = groupMembersRepo;
 }
示例#5
0
 public SlidesController(ILogger logger, IWebCourseManager courseManager, UlearnDb db, IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo,
                         IUserSolutionsRepo solutionsRepo, IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     CourseRolesRepo = courseRolesRepo;
     SolutionsRepo   = solutionsRepo;
     UserQuizzesRepo = userQuizzesRepo;
     VisitsRepo      = visitsRepo;
     GroupsRepo      = groupsRepo;
 }
示例#6
0
 public JoinGroupController(IWebCourseManager courseManager, UlearnDb db,
                            IUsersRepo usersRepo,
                            IGroupsRepo groupsRepo, IGroupMembersRepo groupMembersRepo,
                            ISlideCheckingsRepo slideCheckingsRepo)
     : base(courseManager, db, usersRepo)
 {
     this.groupsRepo         = groupsRepo;
     this.groupMembersRepo   = groupMembersRepo;
     this.slideCheckingsRepo = slideCheckingsRepo;
 }
 public ExerciseStatisticsController(ILogger logger, WebCourseManager courseManager, IUserSolutionsRepo userSolutionsRepo, UlearnDb db, IUsersRepo usersRepo,
                                     IUserSolutionsRepo solutionsRepo, IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.userSolutionsRepo = userSolutionsRepo;
     this.solutionsRepo     = solutionsRepo;
     this.userQuizzesRepo   = userQuizzesRepo;
     this.visitsRepo        = visitsRepo;
     this.groupsRepo        = groupsRepo;
 }
示例#8
0
 public ExportController(IWebCourseManager courseManager, UlearnDb db, IUsersRepo usersRepo,
                         IGroupMembersRepo groupMembersRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo, IUserQuizzesRepo userQuizzesRepo,
                         ICourseRolesRepo courseRolesRepo)
     : base(courseManager, db, usersRepo)
 {
     this.groupMembersRepo = groupMembersRepo;
     this.visitsRepo       = visitsRepo;
     this.groupsRepo       = groupsRepo;
     this.userQuizzesRepo  = userQuizzesRepo;
     this.courseRolesRepo  = courseRolesRepo;
 }
示例#9
0
 public GroupController(ILogger logger, WebCourseManager courseManager, UlearnDb db,
                        IGroupsRepo groupsRepo, IGroupAccessesRepo groupAccessesRepo, IGroupMembersRepo groupMembersRepo, IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo, INotificationsRepo notificationsRepo,
                        IGroupsCreatorAndCopier groupsCreatorAndCopier)
     : base(logger, courseManager, db, usersRepo)
 {
     this.groupsRepo             = groupsRepo;
     this.groupAccessesRepo      = groupAccessesRepo;
     this.groupMembersRepo       = groupMembersRepo;
     this.courseRolesRepo        = courseRolesRepo;
     this.notificationsRepo      = notificationsRepo;
     this.groupsCreatorAndCopier = groupsCreatorAndCopier;
 }
示例#10
0
 public CoursesController(ILogger logger, IWebCourseManager courseManager, UlearnDb db, ICoursesRepo coursesRepo,
                          IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo, IUnitsRepo unitsRepo, IUserSolutionsRepo solutionsRepo,
                          IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo)
     : base(logger, courseManager, db, usersRepo)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
     this.unitsRepo       = unitsRepo;
     this.solutionsRepo   = solutionsRepo;
     this.userQuizzesRepo = userQuizzesRepo;
     this.visitsRepo      = visitsRepo;
     this.groupsRepo      = groupsRepo;
 }
示例#11
0
 public SlidesController(IWebCourseManager courseManager, UlearnDb db, IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo,
                         IUserSolutionsRepo solutionsRepo, IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo,
                         SlideRenderer slideRenderer, ICoursesRepo coursesRepo)
     : base(courseManager, db, usersRepo)
 {
     this.coursesRepo     = coursesRepo;
     this.courseRolesRepo = courseRolesRepo;
     this.solutionsRepo   = solutionsRepo;
     this.userQuizzesRepo = userQuizzesRepo;
     this.visitsRepo      = visitsRepo;
     this.groupsRepo      = groupsRepo;
     this.slideRenderer   = slideRenderer;
 }
示例#12
0
 public GroupController(IWebCourseManager courseManager, UlearnDb db,
                        IGroupsRepo groupsRepo, IGroupAccessesRepo groupAccessesRepo, IGroupMembersRepo groupMembersRepo, IUsersRepo usersRepo, ICourseRolesRepo courseRolesRepo, INotificationsRepo notificationsRepo,
                        IGroupsCreatorAndCopier groupsCreatorAndCopier, IUnitsRepo unitsRepo, ISlideCheckingsRepo slideCheckingsRepo)
     : base(courseManager, db, usersRepo)
 {
     this.groupsRepo             = groupsRepo;
     this.groupAccessesRepo      = groupAccessesRepo;
     this.groupMembersRepo       = groupMembersRepo;
     this.courseRolesRepo        = courseRolesRepo;
     this.notificationsRepo      = notificationsRepo;
     this.groupsCreatorAndCopier = groupsCreatorAndCopier;
     this.unitsRepo          = unitsRepo;
     this.slideCheckingsRepo = slideCheckingsRepo;
 }
示例#13
0
 public CodeReviewStatisticsController(IWebCourseManager courseManager,
                                       ISlideCheckingsRepo slideCheckingsRepo,
                                       IUsersRepo usersRepo,
                                       IGroupsRepo groupsRepo,
                                       IGroupMembersRepo groupMembersRepo,
                                       ICourseRolesRepo courseRolesRepo,
                                       UlearnDb db)
     : base(courseManager, db, usersRepo)
 {
     this.slideCheckingsRepo = slideCheckingsRepo;
     this.groupsRepo         = groupsRepo;
     this.groupMembersRepo   = groupMembersRepo;
     this.courseRolesRepo    = courseRolesRepo;
 }
示例#14
0
 public ExerciseController(IWebCourseManager courseManager, UlearnDb db, MetricSender metricSender,
                           IUsersRepo usersRepo, IUserSolutionsRepo userSolutionsRepo, ICourseRolesRepo courseRolesRepo, IVisitsRepo visitsRepo,
                           ISlideCheckingsRepo slideCheckingsRepo, IGroupsRepo groupsRepo, StyleErrorsResultObserver styleErrorsResultObserver,
                           IStyleErrorsRepo styleErrorsRepo, IServiceScopeFactory serviceScopeFactory)
     : base(courseManager, db, usersRepo)
 {
     this.metricSender              = metricSender;
     this.userSolutionsRepo         = userSolutionsRepo;
     this.courseRolesRepo           = courseRolesRepo;
     this.visitsRepo                = visitsRepo;
     this.slideCheckingsRepo        = slideCheckingsRepo;
     this.groupsRepo                = groupsRepo;
     this.styleErrorsRepo           = styleErrorsRepo;
     this.styleErrorsResultObserver = styleErrorsResultObserver;
     this.serviceScopeFactory       = serviceScopeFactory;
 }
示例#15
0
 public ExerciseController(IWebCourseManager courseManager, UlearnDb db, MetricSender metricSender,
                           IUsersRepo usersRepo, IUserSolutionsRepo userSolutionsRepo, ICourseRolesRepo courseRolesRepo, IVisitsRepo visitsRepo,
                           ILtiConsumersRepo ltiConsumersRepo, ILtiRequestsRepo ltiRequestsRepo, ISlideCheckingsRepo slideCheckingsRepo, IGroupsRepo groupsRepo,
                           IStyleErrorsRepo styleErrorsRepo)
     : base(courseManager, db, usersRepo)
 {
     this.metricSender       = metricSender;
     this.userSolutionsRepo  = userSolutionsRepo;
     this.courseRolesRepo    = courseRolesRepo;
     this.visitsRepo         = visitsRepo;
     this.ltiConsumersRepo   = ltiConsumersRepo;
     this.ltiRequestsRepo    = ltiRequestsRepo;
     this.slideCheckingsRepo = slideCheckingsRepo;
     this.groupsRepo         = groupsRepo;
     this.styleErrorsRepo    = styleErrorsRepo;
 }
示例#16
0
 public GroupAccessesRepo(
     UlearnDb db,
     IGroupsRepo groupsRepo, ISystemAccessesRepo systemAccessesRepo, ICoursesRepo coursesRepo, IGroupMembersRepo groupMembersRepo,
     IUsersRepo usersRepo,
     ICourseRolesRepo courseRolesRepo,
     IWebCourseManager courseManager
     )
 {
     this.db                 = db;
     this.groupsRepo         = groupsRepo;
     this.systemAccessesRepo = systemAccessesRepo;
     this.coursesRepo        = coursesRepo;
     this.groupMembersRepo   = groupMembersRepo;
     this.courseRolesRepo    = courseRolesRepo;
     this.usersRepo          = usersRepo;
     this.courseManager      = courseManager;
 }
示例#17
0
 public RunnerController(IWebCourseManager courseManager, UlearnDb db, IOptions <WebApiConfiguration> options,
                         IUsersRepo usersRepo, IUserSolutionsRepo userSolutionsRepo, ISlideCheckingsRepo slideCheckingsRepo,
                         IGroupsRepo groupsRepo, IVisitsRepo visitsRepo, MetricSender metricSender,
                         XQueueResultObserver xQueueResultObserver, SandboxErrorsResultObserver sandboxErrorsResultObserver,
                         AntiPlagiarismResultObserver antiPlagiarismResultObserver, StyleErrorsResultObserver styleErrorsResultObserver)
     : base(courseManager, db, usersRepo)
 {
     configuration   = options.Value;
     resultObservers = new List <IResultObserver>
     {
         xQueueResultObserver,
         sandboxErrorsResultObserver,
         antiPlagiarismResultObserver,
         styleErrorsResultObserver,
     };
     this.userSolutionsRepo  = userSolutionsRepo;
     this.slideCheckingsRepo = slideCheckingsRepo;
     this.groupsRepo         = groupsRepo;
     this.visitsRepo         = visitsRepo;
     this.metricSender       = metricSender;
 }
示例#18
0
 public GroupsController(IGroupsRepo repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
示例#19
0
        public static async Task <bool> SendToReviewAndUpdateScore(UserExerciseSubmission submissionNoTracking,
                                                                   IWebCourseManager courseManager, ISlideCheckingsRepo slideCheckingsRepo, IGroupsRepo groupsRepo, IVisitsRepo visitsRepo, MetricSender metricSender)
        {
            var userId   = submissionNoTracking.UserId;
            var courseId = submissionNoTracking.CourseId;
            var course   = await courseManager.GetCourseAsync(courseId);

            var exerciseSlide = course.FindSlideById(submissionNoTracking.SlideId, true) as ExerciseSlide;             // SlideId проверен в вызывающем методе

            if (exerciseSlide == null)
            {
                return(false);
            }
            var exerciseMetricId                = GetExerciseMetricId(courseId, exerciseSlide);
            var automaticCheckingNoTracking     = submissionNoTracking.AutomaticChecking;
            var isProhibitedUserToSendForReview = await slideCheckingsRepo.IsProhibitedToSendExerciseToManualChecking(courseId, exerciseSlide.Id, userId);

            var sendToReview = exerciseSlide.Scoring.RequireReview &&
                               submissionNoTracking.AutomaticCheckingIsRightAnswer &&
                               !isProhibitedUserToSendForReview &&
                               await groupsRepo.IsManualCheckingEnabledForUserAsync(course, userId);

            if (sendToReview)
            {
                await slideCheckingsRepo.RemoveWaitingManualCheckings <ManualExerciseChecking>(courseId, exerciseSlide.Id, userId, false);

                await slideCheckingsRepo.AddManualExerciseChecking(courseId, exerciseSlide.Id, userId, submissionNoTracking.Id);

                await visitsRepo.MarkVisitsAsWithManualChecking(courseId, exerciseSlide.Id, userId);

                metricSender.SendCount($"exercise.{exerciseMetricId}.sent_to_review");
                metricSender.SendCount("exercise.sent_to_review");
            }

            await visitsRepo.UpdateScoreForVisit(courseId, exerciseSlide, userId);

            if (automaticCheckingNoTracking != null)
            {
                var verdictForMetric = automaticCheckingNoTracking.GetVerdict().Replace(" ", "");
                metricSender.SendCount($"exercise.{exerciseMetricId}.{verdictForMetric}");
            }

            return(sendToReview);
        }
示例#20
0
        public static async Task <Func <Slide, int> > BuildGetSlideMaxScoreFunc(IUserSolutionsRepo solutionsRepo, IUserQuizzesRepo userQuizzesRepo, IVisitsRepo visitsRepo, IGroupsRepo groupsRepo,
                                                                                Course course, string userId)
        {
            if (userId == null)
            {
                return(GetMaxScoreForGuest);
            }
            var solvedSlidesIds = await GetSolvedSlides(solutionsRepo, userQuizzesRepo, course, userId);

            var slidesWithUsersManualChecking = (await visitsRepo.GetSlidesWithUsersManualChecking(course.Id, userId)).ToImmutableHashSet();
            var enabledManualCheckingForUser  = await groupsRepo.IsManualCheckingEnabledForUserAsync(course, userId).ConfigureAwait(false);

            return(s => GetMaxScoreForUsersSlide(s, solvedSlidesIds.Contains(s.Id), slidesWithUsersManualChecking.Contains(s.Id), enabledManualCheckingForUser));
        }