private ContentModuleTracking GetTracking(string clientId, ContentModuleSession session) { var contModTracking = new ContentModuleTracking { UserID = session.SystemUserGuid, ContentModuleId = session.ContentModuleId, ClientId = clientId }; if (session.Attempt.HasValue) { contModTracking.ID = session.Assignment.ID + "-" + session.SystemUserGuid + "-" + session.Attempt.Value; } contModTracking.IsResume = session.IsReview; contModTracking.ContentType = session.ContentModule.ContentModuleTypeId; contModTracking = _contentModuleTrackingRepository.GetContentModuleLessonTracking(contModTracking); contModTracking.IsForAdminPreview = (session.LaunchSite == LaunchSite.Admin); contModTracking.UserID = session.SystemUserGuid; contModTracking.UserFirstLastName = session.Learner.LastName + ", " + session.Learner.FirstName; contModTracking.ContentModuleId = session.ContentModuleId; contModTracking.SessionId = session.SessionId; contModTracking.TotalNoOfPages = session.ContentModule.TotalLessons; contModTracking.ContentType = session.ContentModule.ContentModuleTypeId; return(contModTracking); }
public ContentModuleTracking SaveTracking(LessonTracking tracking, TrackingSessionMetaData metaData) { ContentModuleTracking trackingToGet = new ContentModuleTracking { ClientId = metaData.ClientId, ContentType = metaData.ContentType, SessionId = metaData.SessionId, UserID = metaData.LearnerId, ContentModuleId = metaData.CourseId }; var currentTracking = _dataManager.GetContentModuleLessonTracking(trackingToGet); if (String.IsNullOrEmpty(currentTracking.ID)) { var session = _sessionRepository.GetByIdForCourseLaunch(metaData.LearnerId, metaData.CourseId); currentTracking = session.ContentModuleTracking; } currentTracking.SessionId = metaData.SessionId; currentTracking.ClientId = metaData.ClientId; currentTracking.ContentType = metaData.ContentType; if (tracking.RawScore.HasValue) { //var clientCourseConfig = _courseConfigurationRepository.GetConfiguration(metaData.ClientId); int iMasteryScore; bool bGetMasteryScore = Int32.TryParse(System.Configuration.ConfigurationSettings.AppSettings["MasteryScore"].ToString(), out iMasteryScore); tracking.MasteryScore = iMasteryScore; //clientCourseConfig.MasteryScore; //if (!clientCourseConfig.ScoreTracking) //{ // tracking.RawScore = null; //} } //if (currentTracking.LessonTracking == null) //{ // currentTracking.LessonTracking = tracking; //} var trackingToSave = _trackingUpdater.UpdateTracking(tracking, currentTracking); return(_dataManager.UpdateContentModuleTracking(trackingToSave)); //return new ContentModuleTracking(); }