|
@@ -2,11 +2,12 @@
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
+using System.Linq;
|
|
|
using System.Threading.Tasks;
|
|
|
using Console = HyperCube.Utils.AdvConsole;
|
|
|
|
|
|
namespace HyperCube.Models
|
|
|
-{
|
|
|
+{
|
|
|
public enum ArticleStatus {
|
|
|
[Display(Name = "Новый")]
|
|
|
New = 0,
|
|
@@ -53,7 +54,7 @@ namespace HyperCube.Models
|
|
|
public string Keywords2 { get; set; }
|
|
|
|
|
|
/// collection for history of verification
|
|
|
- public Dictionary<int, VerificationPoint> VerificationHistory { get; set; }
|
|
|
+ public Dictionary<int, VerificationPoint> VerificationHistory { get; set; } = new();
|
|
|
|
|
|
public int? Rating
|
|
|
{
|
|
@@ -116,14 +117,14 @@ namespace HyperCube.Models
|
|
|
return initiatorUUID;
|
|
|
}
|
|
|
|
|
|
- public async Task<Dictionary<int, VerificationPoint>> GetVerificationHistory(int articleid, string acc_uuid)
|
|
|
+ public async Task<Dictionary<int, VerificationPoint>> GetVerificationHistory(string acc_uuid)
|
|
|
{
|
|
|
- Console.WriteLine($"GetVerificationHistory for article [{articleid}]");
|
|
|
+ Console.WriteLine($"GetVerificationHistory for article [{this.ID}]");
|
|
|
|
|
|
- Dictionary<int, VerificationPoint> verificationHistory = new();
|
|
|
+ //Dictionary<int, VerificationPoint> verificationHistory = new();
|
|
|
VerificationPoint verificationPoint;
|
|
|
|
|
|
- var vps = await MySQLConnector.Instance().SQLSelectComplex($"SELECT * FFROM articles_verification WHERE article_id='{articleid}'"); //AND acc_id='{acc_uuid}'
|
|
|
+ var vps = await MySQLConnector.Instance().SQLSelectComplex($"SELECT * FROM articles_verification WHERE article_id='{this.ID}'"); //AND acc_id='{acc_uuid}'
|
|
|
if (vps.Count > 0)
|
|
|
{
|
|
|
foreach (var vp in vps)
|
|
@@ -140,26 +141,26 @@ namespace HyperCube.Models
|
|
|
DateAdd = Convert.ToDateTime(vp["date_add"])
|
|
|
};
|
|
|
Console.WriteLine($"add verificationPoint. id: {verificationPoint.ID}, rules_violation: {verificationPoint.RulesViolation}, date_add: {verificationPoint.DateAdd}");
|
|
|
- verificationHistory.Add(verificationPoint.ID, verificationPoint);
|
|
|
+ VerificationHistory.Add(verificationPoint.ID, verificationPoint);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
- Console.WriteLine($"Article [{articleid}] has no history yet.");
|
|
|
+ Console.WriteLine($"Article [{this.ID}] has no history yet.");
|
|
|
|
|
|
- return verificationHistory;
|
|
|
+ return VerificationHistory;
|
|
|
}
|
|
|
|
|
|
- public async Task SaveVerificationPoint(VerificationPoint verificationPoint, string acc_uuid)
|
|
|
+ public async Task SaveLastVerificationPoint(VerificationPoint verificationPoint, string acc_uuid)
|
|
|
{
|
|
|
- //Console.WriteLine($"SaveVerificationPoint");
|
|
|
-
|
|
|
+ //Console.WriteLine($"SaveVerificationPoint");
|
|
|
+
|
|
|
int rules_violation = Convert.ToInt32(verificationPoint.RulesViolation);
|
|
|
- int nonexpert = Convert.ToInt32(verificationPoint.RulesViolation);
|
|
|
- int additional_verification_required = Convert.ToInt32(verificationPoint.RulesViolation);
|
|
|
- int rejected = Convert.ToInt32(verificationPoint.RulesViolation);
|
|
|
+ int nonexpert = Convert.ToInt32(verificationPoint.NonExpert);
|
|
|
+ int additional_verification_required = Convert.ToInt32(verificationPoint.AdditionalVerificationRequired);
|
|
|
+ int rejected = Convert.ToInt32(verificationPoint.Rejected);
|
|
|
|
|
|
- if (verificationPoint.ID == 0) ///new point
|
|
|
- {
|
|
|
+ //if (verificationPoint.ID == 0) ///new point
|
|
|
+ //{
|
|
|
Console.WriteLine($"SaveVerificationPoint. New point to save");
|
|
|
|
|
|
long id = await MySQLConnector.Instance().SQLInsert($"INSERT INTO articles_verification " +
|
|
@@ -175,16 +176,16 @@ namespace HyperCube.Models
|
|
|
}
|
|
|
else
|
|
|
Console.WriteLine($"SaveVerificationPoint. Something went wrong, id < 1");
|
|
|
- }
|
|
|
- else ///existed
|
|
|
- {
|
|
|
- Console.WriteLine($"SaveVerificationPoint. Existed point to save, id: {verificationPoint.ID}");
|
|
|
-
|
|
|
- await MySQLConnector.Instance().SQLInsert($"UPDATE articles_verification SET " +
|
|
|
- $"acc_id='{acc_uuid}', rules_violation='{rules_violation}', nonexpert='{nonexpert}', additional_verification_required={additional_verification_required}, " +
|
|
|
- $"rejected={rejected}, reject_reason={verificationPoint.RejectReason}, tags={verificationPoint.Tags}) " +
|
|
|
- $"WHERE id={verificationPoint.ID}");
|
|
|
- }
|
|
|
+ //}
|
|
|
+ //else ///existed
|
|
|
+ //{
|
|
|
+ // Console.WriteLine($"SaveVerificationPoint. Existed point to save, id: {verificationPoint.ID}");
|
|
|
+
|
|
|
+ // await MySQLConnector.Instance().SQLInsert($"UPDATE articles_verification SET " +
|
|
|
+ // $"acc_id='{acc_uuid}', rules_violation='{rules_violation}', nonexpert='{nonexpert}', additional_verification_required={additional_verification_required}, " +
|
|
|
+ // $"rejected={rejected}, reject_reason={verificationPoint.RejectReason}, tags={verificationPoint.Tags}) " +
|
|
|
+ // $"WHERE id={verificationPoint.ID}");
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
public object Clone()
|