Commit df26e0f0918d5476fd8ec3b8de184f40d26e22e4
1 parent
64b93207
Exists in
master
and in
4 other branches
Hack: add 'archived' to categories(themes)
Showing
2 changed files
with
34 additions
and
1 deletions
Show diff stats
src/app/components/article-service/article.service.js
src/app/components/dialoga-service/dialoga.service.js
... | ... | @@ -321,6 +321,40 @@ |
321 | 321 | } |
322 | 322 | |
323 | 323 | _pipeCalcColors(data); |
324 | + _pipeCheckArchived(data); | |
325 | + } | |
326 | + | |
327 | + | |
328 | + function _pipeCheckArchived(data){ | |
329 | + | |
330 | + var programs = data.article.children; // Programas | |
331 | + var themes = data.article.categories; // Temas | |
332 | + | |
333 | + // para cada Tema | |
334 | + for (var i = themes.length - 1; i >= 0; i--) { | |
335 | + var theme = themes[i]; | |
336 | + | |
337 | + // para cada programa | |
338 | + for (var j = programs.length - 1; j >= 0; j--) { | |
339 | + var program = programs[j]; | |
340 | + | |
341 | + // Verifica se o programa 'j' perntece ao tema 'i' | |
342 | + if(program.categories && program.categories.length > 0){ | |
343 | + if(angular.equals(program.categories[0].slug, theme.slug)){ | |
344 | + | |
345 | + // Verifica se o programa está 'congelado' (archived) | |
346 | + if(program.archived){ | |
347 | + theme.archived = true; | |
348 | + break; | |
349 | + } | |
350 | + } | |
351 | + } | |
352 | + } | |
353 | + | |
354 | + if(!theme.archived){ | |
355 | + theme.archived = false; | |
356 | + } | |
357 | + } | |
324 | 358 | } |
325 | 359 | |
326 | 360 | function _pipeSetPrograms (data) { | ... | ... |