Przeglądaj źródła

Logiciel: Evolution #838: Base de connaissance

Bastien Sevajol 11 lat temu
rodzic
commit
6a936d186d

+ 1 - 14
src/Muzich/CoreBundle/Command/MineTagsDataCommand.php Wyświetl plik

@@ -17,14 +17,12 @@ class MineTagsDataCommand extends ContainerAwareCommand
17 17
   const MINE_FAVORITE = 'favorite';
18 18
   const MINE_PLAYLIST = 'playlist';
19 19
   const MINE_TAGS = 'tags';
20
-  const MINE_TOPS = 'tops';
21 20
   
22 21
   static $mine_types = array(
23 22
     self::MINE_DIFFUSION,
24 23
     self::MINE_FAVORITE,
25 24
     self::MINE_PLAYLIST,
26
-    self::MINE_TAGS,
27
-    self::MINE_TOPS
25
+    self::MINE_TAGS
28 26
   );
29 27
   
30 28
   protected $em;
@@ -44,7 +42,6 @@ class MineTagsDataCommand extends ContainerAwareCommand
44 42
       ->addOption(self::MINE_FAVORITE, null, InputOption::VALUE_NONE, 'Ne traite que les favoris')
45 43
       ->addOption(self::MINE_PLAYLIST, null, InputOption::VALUE_NONE, 'Ne traite que les playlists')
46 44
       ->addOption(self::MINE_TAGS, null, InputOption::VALUE_NONE, 'Ne traite que les tags')
47
-      ->addOption(self::MINE_TOPS, null, InputOption::VALUE_NONE, 'Ne traite que les top tags')
48 45
     ;
49 46
   }
50 47
   
@@ -89,9 +86,6 @@ class MineTagsDataCommand extends ContainerAwareCommand
89 86
     if ($this->canIMineThat(self::MINE_TAGS))
90 87
       $this->mineTags();
91 88
     
92
-    if ($this->canIMineThat(self::MINE_TOPS))
93
-      $this->mineTopTags();
94
-    
95 89
     $this->output->writeln('<info>Terminé !</info>');
96 90
   }
97 91
   
@@ -139,13 +133,6 @@ class MineTagsDataCommand extends ContainerAwareCommand
139 133
     $this->getTagMiner()->mineTagsForUsers($this->users_mineds);
140 134
   }
141 135
   
142
-  protected function mineTopTags()
143
-  {
144
-    $this->output->writeln('<info>TopTags: '.count($this->users_mineds).' utilisateurs</info>');
145
-    $this->progress->start($this->output, count($this->users_mineds));
146
-    $this->getTagMiner()->mineTopTagsForUsers($this->users_mineds);
147
-  }
148
-  
149 136
   protected function getUsersToProceed($condition)
150 137
   {
151 138
     $users_query_builder = $this->getUserQueryBuilder();

+ 5 - 95
src/Muzich/CoreBundle/Document/EntityTags.php Wyświetl plik

@@ -27,37 +27,7 @@ class EntityTags
27 27
   /**
28 28
    * @MongoDB\Collection
29 29
    */
30
-  protected $tags_top_1;
31
-
32
-  /**
33
-   * @MongoDB\Collection
34
-   */
35
-  protected $tags_top_2;
36
-
37
-  /**
38
-   * @MongoDB\Collection
39
-   */
40
-  protected $tags_top_3;
41
-
42
-  /**
43
-   * @MongoDB\Collection
44
-   */
45
-  protected $tags_top_5;
46
-
47
-  /**
48
-   * @MongoDB\Collection
49
-   */
50
-  protected $tags_top_10;
51
-
52
-  /**
53
-   * @MongoDB\Collection
54
-   */
55
-  protected $tags_top_25;
56
-
57
-  /**
58
-   * @MongoDB\Collection
59
-   */
60
-  protected $tags_all;
30
+  protected $tags;
61 31
 
62 32
   public function getId()
63 33
   {
@@ -74,74 +44,14 @@ class EntityTags
74 44
     $this->ref = (int)$ref;
75 45
   }
76 46
 
77
-  public function getTagsAll()
78
-  {
79
-    return $this->tags_all;
80
-  }
81
-  
82
-  public function setTagsAll($tags)
83
-  {
84
-    $this->tags_all = $tags;
85
-  }
86
-  
87
-  public function setTagsTop1($tags)
88
-  {
89
-    $this->tags_top_1 = $tags;
90
-  }
91
-  
92
-  public function getTagsTop1()
93
-  {
94
-    return $this->tags_top_1;
95
-  }
96
-  
97
-  public function setTagsTop2($tags)
98
-  {
99
-    $this->tags_top_2 = $tags;
100
-  }
101
-  
102
-  public function getTagsTop2()
103
-  {
104
-    return $this->tags_top_2;
105
-  }
106
-  
107
-  public function setTagsTop3($tags)
108
-  {
109
-    $this->tags_top_3 = $tags;
110
-  }
111
-  
112
-  public function getTagsTop3()
113
-  {
114
-    return $this->tags_top_3;
115
-  }
116
-  
117
-  public function setTagsTop5($tags)
118
-  {
119
-    $this->tags_top_5 = $tags;
120
-  }
121
-  
122
-  public function getTagsTop5()
123
-  {
124
-    return $this->tags_top_5;
125
-  }
126
-  
127
-  public function setTagsTop10($tags)
128
-  {
129
-    $this->tags_top_10 = $tags;
130
-  }
131
-  
132
-  public function getTagsTop10()
133
-  {
134
-    return $this->tags_top_10;
135
-  }
136
-  
137
-  public function setTagsTop25($tags)
47
+  public function getTags()
138 48
   {
139
-    $this->tags_top_25 = $tags;
49
+    return $this->tags;
140 50
   }
141 51
   
142
-  public function getTagsTop25()
52
+  public function setTags($tags)
143 53
   {
144
-    return $this->tags_top_25;
54
+    $this->tags = $tags;
145 55
   }
146 56
   
147 57
 }

+ 1 - 37
src/Muzich/CoreBundle/Mining/Tag/TagMiner.php Wyświetl plik

@@ -119,11 +119,6 @@ class TagMiner extends Base
119 119
     $this->mineForUsers($users, 'orderUserTags');
120 120
   }
121 121
   
122
-  public function mineTopTagsForUsers($users)
123
-  {
124
-    $this->mineForUsers($users, 'determineTagsTops');
125
-  }
126
-  
127 122
   /** @return EntityTags */
128 123
   protected function getEntityTagsDocument($ref, $type)
129 124
   {
@@ -204,38 +199,7 @@ class TagMiner extends Base
204 199
       $user_tags->getElementPlaylistTags()
205 200
     ), $user->getTagsFavoritesQuickIds());
206 201
     
207
-    $user_tags->setTagsAll($all_tags_ordered);
208
-  }
209
-  
210
-  protected function determineTagsTops(EntityTags $user_tags, User $user)
211
-  {
212
-    $user_tags->setTagsTop1($this->getTopTagsRange($user_tags->getTagsAll(), 1));
213
-    $user_tags->setTagsTop2($this->getTopTagsRange($user_tags->getTagsAll(), 2));
214
-    $user_tags->setTagsTop3($this->getTopTagsRange($user_tags->getTagsAll(), 3));
215
-    $user_tags->setTagsTop5($this->getTopTagsRange($user_tags->getTagsAll(), 5));
216
-    $user_tags->setTagsTop10($this->getTopTagsRange($user_tags->getTagsAll(), 10));
217
-    $user_tags->setTagsTop25($this->getTopTagsRange($user_tags->getTagsAll(), 25));
218
-  }
219
-  
220
-  protected function getTopTagsRange($tags, $range_end)
221
-  {
222
-    $tags_top = array();
223
-    if ($range_end <= count($tags))
224
-    {
225
-      $max = $range_end;
226
-    }
227
-    else
228
-    {
229
-      $max = count($tags);
230
-    }
231
-      
232
-    for ($index = 0; $index <= $max-1; $index++)
233
-    {
234
-      $tags_top[] = $tags[$index];
235
-    }
236
-    
237
-    
238
-    return $tags_top;
202
+    $user_tags->setTags($all_tags_ordered);
239 203
   }
240 204
   
241 205
 }