示例#1
0
 private ScheduleInfo GetScheduleInfo()
 {
     return(new ScheduleInfo()
     {
         LastPromptDate = LastPromptDate.ToString("yyyy-MM-dd"), Modules = Modules.Values.ToList()
     });
 }
示例#2
0
        public bool ShouldPropmtSurvey(string moduleName, Version moduleVersion)
        {
            if (_ignoreSchedule || IsDisabledFromEnv)
            {
                return(false);
            }

            int majorVersion = moduleVersion.Major;

            if (Modules.Count == 0)
            {
                ReadFromStream();
            }

            if (ShouldFlush(moduleName, majorVersion, ShouldModuleAdd, ModuleAdd))
            {
                FlushWithWaitAsync();
                return(false);
            }

            //LastPromptDate.CompareTo(DateTime.MinValue) > 0 means survey is locked, otherwise lock free
            if (LastPromptDate > DateTime.MinValue && Today > LastPromptDate.AddDays(_lockExpiredDays))
            {
                LastPromptDate = DateTime.MinValue;
            }

            if (ShouldFlush(moduleName, majorVersion, ShouldAzPredictorPrompt, AzPredictorPrompt) ||
                ShouldFlush(moduleName, majorVersion, ShouldModulePrompt, ModulePrompt))
            {
                FlushAsync();
                return(true);
            }

            if ((ShouldFlush(moduleName, majorVersion, ShouldModuleBumpVersion, ModuleBumpVersion) ||
                 ShouldFlush(moduleName, majorVersion, ShouldModuleCount, ModuleCount) ||
                 ShouldFlush(moduleName, majorVersion, ShouldModuleCountExpire, ModuleCountExpire) ||
                 ShouldFlush(moduleName, majorVersion, ShouldModulePromptExpire, ModulePromptExpire)))
            {
                FlushWithWaitAsync();
            }
            return(false);
        }
示例#3
0
 private bool ShouldModulePromptExpire(SurveyHelper helper, string moduleName, int majorVersion)
 => helper.Modules[moduleName].MajorVersion == majorVersion &&
 (Modules[moduleName].ActiveDays == _surveyTriggerCount + 1 && helper.LastPromptDate == Convert.ToDateTime(Modules[moduleName].LastActiveDate) && helper.Today > helper.LastPromptDate.AddDays(_delayForSecondPrompt) ||
  Modules[moduleName].ActiveDays == _surveyTriggerCount + 2 && helper.LastPromptDate == Convert.ToDateTime(Modules[moduleName].LastActiveDate) && helper.Today > LastPromptDate.AddDays(_delayForThirdPrompt));