public static object UserTestsView(UrlHelper url, List <UserTest> userTests) { return(table.Class("defaultTable")[Head("ФИО", "Время", "Дата", "Статус"), userTests.Select(x => Row( x.User.FullName, TimeSpan.FromSeconds(x.Time).ToString("mm\\:ss"), x.RunDate.DefaultWithTimeString(), url.UserTestLink(x, UserTestStatus.GetName(x.Status)).OpenInUiDialog()) )]); }
public List <List <string> > GetResultData(List <List <UserTest> > userTests, bool trackTest = false) { var items = _.List("Тест", "Фио", "Результат", "Ответы(П \\ Н)", "Дата", "Модули:"); var data = new List <List <string> >(); foreach (var userTestList in userTests) { if (!userTestList.Any()) { continue; } var modules = TestModuleService.GetForTest(userTestList.First().TestId).OrderBy(x => x.Id).ToList(); data.Add(new List <string>(items).AddFluent(modules.Select(x => x.Name)));; foreach (var userTest in userTestList) { var stats = EntityUtils.GetStats(userTest); data.Add(_.List(userTest.Test.Name, userTest.User.FullName, trackTest ? UserTestStatus.TrackNames[userTest.Status] : UserTestStatus.GetName(userTest.Status), new UserTestStats.RightWrong { R = userTest.RightCount.GetValueOrDefault(), W = userTest.WrongCount.GetValueOrDefault() }.ToString(), userTest.RunDate.DefaultWithTimeString()).AddFluent("").AddFluent( stats.Select(x => x.Value.ToString()))); } } return(data); }