//DONE
 public List <IUser> PreliminaryFiltering(ITweet[] forFilter)
 {
     for (int i = 0; i < forFilter.Length; i++)
     {
         var followersCount = forFilter[i].CreatedBy.FollowersCount;
         var friendsCount   = forFilter[i].CreatedBy.FriendsCount;
         var followerRank   = (double)followersCount / (double)(followersCount + friendsCount);
         if (followersCount > ProFeedApiParameters.ProFeedAlgParameters.MinFolowers && followersCount < ProFeedApiParameters.ProFeedAlgParameters.MaxFolowers && followerRank > ProFeedApiParameters.ProFeedAlgParameters.MinRankFirstStep)
         {
             if (!Influencers.Contains(forFilter[i].CreatedBy))
             {
                 Influencers.Add(forFilter[i].CreatedBy);
                 InfluencersDagree.Add(1);
             }
             else
             {
                 var index = Influencers.IndexOf(forFilter[i].CreatedBy);
                 InfluencersDagree[index]++;
             }
             Console.WriteLine(Influencers);
         }
     }
     AlgoLevel++;
     PotentialInfluencersFriend();
     return(Influencers);
 }
Exemple #2
0
        public async void Get()
        {
            var jData = await DataService.Get($"Influencer/{Preferences.Get("TeamId", "")}");

            if (jData == "ConnectionError")
            {
                StandardMessagesDisplay.NoConnectionToast();
            }
            else if (jData == "null")
            {
                StandardMessagesDisplay.NoDataDisplayMessage();
            }
            else if (jData == "Error")
            {
                StandardMessagesDisplay.Error();
            }
            else if (jData == "ErrorTracked")
            {
                StandardMessagesDisplay.ErrorTracked();
            }
            else
            {
                try
                {
                    var data = JsonConvert.DeserializeObject <Dictionary <string, InfluencerModel> >(jData);

                    if (data != null)
                    {
                        foreach (KeyValuePair <string, InfluencerModel> item in data)
                        {
                            Influencers?.Add(
                                new InfluencerModel
                            {
                                Id       = item.Value.Id,
                                FId      = item.Key.ToString(),
                                Name     = item.Value.Name,
                                Contact  = item.Value.Contact,
                                Position = item.Value.Position,
                                DoesHeProvidingSupport = item.Value.DoesHeProvidingSupport
                            }
                                );
                        }
                    }
                }
                catch (Exception ex)
                {
                    Crashes.TrackError(ex);
                    StandardMessagesDisplay.InputToast(ex.Message);
                }
            }
        }
 public List <IUser> PreliminaryFiltering(IUser[] forFilter)
 {
     for (int i = 0; i < forFilter.Length; i++)
     {
         var followersCount = forFilter[i].FollowersCount;
         var friendsCount   = forFilter[i].FriendsCount;
         var followerRank   = (double)followersCount / (double)(followersCount + friendsCount);
         if (followersCount > ProFeedApiParameters.ProFeedAlgParameters.MinFolowers && followersCount < ProFeedApiParameters.ProFeedAlgParameters.MaxFolowers && followerRank > ProFeedApiParameters.ProFeedAlgParameters.MinRankScondStep)
         {
             if (!Influencers.Contains(forFilter[i]))
             {
                 Influencers.Add(forFilter[i]);
                 InfluencersDagree.Add(1);
             }
             else
             {
                 var index = Influencers.IndexOf(forFilter[i]);
                 InfluencersDagree[index]++;
             }
         }
     }
     AlgoLevel++;
     return(Influencers);
 }