public Movement Get(int id)
 {
     return(_service.Get(id));
 }
Esempio n. 2
0
        public TestResult Test(List <Movement> movements)
        {
            var headers  = Request.Headers;
            var userName = headers.GetValues("UserName").First();

            var batches = _movementService.Get();

            var count = (double)batches.Count(x => x.UserName == userName);

            if (count < 10)
            {
                _movementService.Save(userName, movements);
                return(new TestResult()
                {
                    UserName = userName, Verified = true, Score = Math.Round(count * 100 / 10, 0)
                });
            }

            var itemsNumber = Math.Min(movements.Count, 20);

            var testResult = new TestResult();

            testResult.UserName = userName;

            var singleitemValue = 100f / 3f;
            var svm             = new SVMService();

            //if (svm.TestFactor(Factor.AngleOfCurvature, batches, movements, userName, itemsNumber, 1, svm.CalculateVector))
            //{
            //    testResult.Score += singleitemValue;
            //    testResult.Description += "AngleOfCurvature; ";
            //}
            //if (svm.TestFactor(Factor.CurvatureDistance, batches, movements, userName, itemsNumber, 1, svm.CalculateVector))
            //{
            //    testResult.Score += singleitemValue;
            //    testResult.Description += "CurvatureDistance; ";
            //}
            //if (svm.TestFactor(Factor.Direction, batches, movements, userName, itemsNumber, 1, svm.CalculateVector))
            //{
            //    testResult.Score += singleitemValue;
            //    testResult.Description += "Direction; ";
            //}

            if (svm.TestFactor(Factor.AngleOfCurvature, batches, movements, userName, 36, 10, svm.CalculateCDVector))
            {
                testResult.Score       += singleitemValue;
                testResult.Description += "CD:AngleOfCurvature; ";
            }
            if (svm.TestFactor(Factor.CurvatureDistance, batches, movements, userName, 10, .1, svm.CalculateCDVector))
            {
                testResult.Score       += singleitemValue;
                testResult.Description += "CD:CurvatureDistance; ";
            }
            if (svm.TestFactor(Factor.Direction, batches, movements, userName, 36, 10, svm.CalculateCDVector))
            {
                testResult.Score       += singleitemValue;
                testResult.Description += "CD:Direction; ";
            }

            testResult.Score = Math.Min(Math.Round(testResult.Score, 2), 100);
            if (testResult.Score > 60)
            {
                testResult.Verified = true;
                _movementService.Save(userName, movements);
            }

            return(testResult);
        }
Esempio n. 3
0
 public Batch[] Get()
 {
     return(_movementService.Get());
 }