Exemplo n.º 1
0
        private void CalibrateKeywordsForGroup(KeywordsCalibrationViewModel model, Transaction transaction)
        {
            var transactions = transactionManager.GetByGroupId(transaction.GroupId);

            foreach (var vote in model.Votes)
            {
                analysisManager.VoteForKeyword(model.CategoryId, vote.Keyword, vote.VoteResult, transactions.Count);
            }

            foreach (var usedTransaction in  transactions)
            {
                analysisManager.MarkTransactionAsVoted(usedTransaction.Id);
            }
        }
Exemplo n.º 2
0
        public ActionResult CalibrateKeywords(KeywordsCalibrationViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(false));
            }

            var transaction = transactionManager.Get(model.TransactionId);

            if (!transaction.GroupId.IsEmpty())
            {
                CalibrateKeywordsForGroup(model, transaction);
                return(Json(true));
            }

            foreach (var vote in model.Votes)
            {
                analysisManager.VoteForKeyword(model.CategoryId, vote.Keyword, vote.VoteResult, 1);
            }

            analysisManager.MarkTransactionAsVoted(model.TransactionId);

            return(Json(true));
        }