Browse Source

рейтинги статьи

Rimmon 3 năm trước cách đây
mục cha
commit
24e8eb1b5a
4 tập tin đã thay đổi với 33 bổ sung8 xóa
  1. 1 1
      HyperCube.csproj.user
  2. 11 1
      Models/AccountModel.cs
  3. 17 4
      Models/ArticleModel.cs
  4. 4 2
      Models/SmartContract.cs

+ 1 - 1
HyperCube.csproj.user

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <NameOfLastUsedPublishProfile>c:\ProjectHyperCube\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
+    <NameOfLastUsedPublishProfile>C:\ProjectHyperCube\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
     <ActiveDebugProfile>HyperCube</ActiveDebugProfile>
     <RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
     <RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>

+ 11 - 1
Models/AccountModel.cs

@@ -35,12 +35,22 @@ namespace HyperCube.Models
         [Inject]
         ProtectedSessionStorage storage { get; set; }
         //public event EventHandler<int> RolesChanged;
+        int ratingExpert;
+        int ratingProspector;
+        public int GetRatingExpert()
+        {
+            return ratingExpert;
+        }
+        public int GetRatingProspector()
+        {
+            return ratingProspector;
+        }
         public Action<int> RolesChanged;
         public byte bsel = 0;
         public byte blockchain_selected
         {
             get { return bsel; }
-            set {               
+            set {
                 bsel = value;
                 bcselupdate();
             }

+ 17 - 4
Models/ArticleModel.cs

@@ -32,8 +32,8 @@ namespace HyperCube.Models
         [Required]
         public string HashSum { get; set; }
         public string FilenameReal { get { return ID + "_" + Filename; } }
-        [Required]        
-        public string Name { get; set; }        
+        [Required]
+        public string Name { get; set; }
         [Required]
         public DateTime PublishDate { get; set; } = DateTime.Now.Date;
         [Required]
@@ -41,10 +41,10 @@ namespace HyperCube.Models
         [Required]
         public string Keywords { get; set; }
         public string Tags { get; set; }
-        public int CharsCount { get; set; }
+        public int CharCount { get; set; }
         [Required]
         public string Annotation { get; set; }
-        public string Text { get; set; }        
+        public string Text { get; set; }
 
         public ArticleStatus Status { get; set; } = ArticleStatus.New;
 
@@ -55,8 +55,21 @@ namespace HyperCube.Models
         public string Keywords1 { get; set; }
         public string Keywords2 { get; set; }
 
+        public float[] weights = new float[] {1,1,1,1,1,1,1};
+
         /// collection for history of verification
         public Dictionary<int, VerificationPoint> VerificationHistory { get; set; } = new();
+        public int CalcPValue()
+        {            
+            var P1 = CharCount;
+            var P2 = Keywords.Split(",").Length;
+            var P3 = Tags.Split(",").Length;
+            var P4 = 1; //параметр качества аннотации, измеряется семантическим алгоритмом Системы
+            var P5 = 1; //параметр рейтинга издания, численно равен единице, делённой на номер квартиля издания, при отсутствии квартиля равен 0,2
+            var P6 = 1; //параметр страны, численно равен единице, делённой на номер группы рейтинга страны
+            var P7 = 1; //параметр ценности нарратива, измеряется семантическим алгоритмом Системы.
+            return (int) Math.Floor(P1 * weights[0] + P2 * weights[1] + P3 * weights[2] + P4 * weights[3] + P5 * weights[4] + P6 * weights[5] + P7 * weights[6]);
+        }
 
         public int? Rating
         {

+ 4 - 2
Models/SmartContract.cs

@@ -109,7 +109,7 @@ namespace HyperCube.Models
         {
             return await MySQLConnector.Instance().SQLInsert($"insert into functions (name_with_args, contract_id, compiled_header) values ('{name_with_args}',{ID},'{compiled_header}')");
         }
-    }
+    }    
 
     public class VerifyContract : SmartContract
     {
@@ -136,7 +136,9 @@ namespace HyperCube.Models
                 initiator = AccountModel.Find(uuidInitiator);
                 Console.WriteLine($"verify verifier {verifier.UUID} initiator found " + initiator+ " bc port "+ bc.port+ $" initiator_address {initiator.GetActualAddress(bc)}");
                 var initiator_address = await initiator.GetOrCreateActualAddress(bc);
-                var article_value = (int)newArticle.Rating;
+                //var article_value = (int)newArticle.Rating;
+                var article_value = newArticle.CalcPValue();
+                article_value *= verifier.GetRatingExpert()*initiator.GetRatingProspector();
 
                 var article_value_hex = article_value.ToString("X64");
                 //Console.WriteLine($"article_value {article_value} hex {article_value_hex}");