Skip to content

Commit

Permalink
Correcao de problemas de manutenibilidade
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielRoger07 committed Aug 30, 2024
1 parent b5af374 commit 2e04299
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
16 changes: 0 additions & 16 deletions src/app/pages/video-viewer/video-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export class VideoViewerComponent implements OnInit {
}

filterRecommendVideo(): void {
console.log("teste: ", Object.values(this.recommendedVideos.recommend_videos));
this.recommendedVideo = Object.values(this.recommendedVideos.recommend_videos)[0];
}

Expand All @@ -135,7 +134,6 @@ export class VideoViewerComponent implements OnInit {
this.videoService.videosCatalog(this.unbTvVideos, this.catalog)

if(this.authService.isAuthenticated() && this.trackingEnabled){
console.log("dentro do if")
//Loop para encontrar a categoria do vídeo atual
this.unbTvVideos.forEach((video) => {
if(video.id == this.idVideo){
Expand All @@ -147,19 +145,12 @@ export class VideoViewerComponent implements OnInit {
this.program = this.videoService.findProgramName(this.catalog, this.categoryVideo, this.idVideo);

this.videosByCategory = this.videoService.filterVideosByCategory(this.unbTvVideos, this.categoryVideo);
console.log("vídeos da categoria do atual: ", this.videosByCategory)
this.filterVideosByRecord();
console.log("videos assistidos: ", this.filteredVideos)
this.filterRecommendVideo();
this.idNextVideo = this.videoService.recommendVideo(this.videosByCategory, this.catalog, this.categoryVideo, this.filteredVideos, this.program, this.recommendedVideo);
}else{
console.log("dentro do else")
console.log("id do video atual: ", this.idVideo)
console.log("array de videos unbtv: ", this.unbTvVideos)
for(const i in this.unbTvVideos){
if(this.unbTvVideos[i].id == this.idVideo){
console.log("video encontrado: ", this.unbTvVideos[i])
console.log("posição do vídeo atual no array: ", i)
if(Number(i) == (this.unbTvVideos.length - 1)){
this.idNextVideo = Number(this.unbTvVideos[0].id);
}else{
Expand All @@ -168,27 +159,20 @@ export class VideoViewerComponent implements OnInit {
break;
}
}
console.log("próximo video: ", this.unbTvVideos[this.idNextVideo])

}
//Se o id for diferente de -1, o usuário ainda não viu todos os vídeos da categoria atual
if(this.idNextVideo != -1){
console.log("entrou no if do next video: ", this.idNextVideo)
//Loop para encontrar o título do próximo vídeo
this.unbTvVideos.forEach((video) => {
//console.log("id do video: ", video.id)
if(video.id == this.idNextVideo){
console.log("entrou aqui")
this.titleNextVideo = video.title;
return;
}
})
}else{
console.log("entrou no else do next video")
this.titleNextVideo = "Não há vídeo para ser recomendado"
}
console.log("id do próximo vídeo: ", this.idNextVideo)
console.log("título do próximo vídeo: ", this.titleNextVideo)
},
error: (error) => {
console.log(error);
Expand Down
5 changes: 0 additions & 5 deletions src/app/services/video.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,13 @@ export class VideoService {
if (section) {
for (const video of section) {
if (video.id == currentVideoId) {
//console.log(`o programa é ${programName}`);
return programName;
}
}
}
}
}
}
//console.log("o programa é unb tv");
return "unbtv";
}

Expand All @@ -342,7 +340,6 @@ export class VideoService {

if(program != 'unbtv'){
const currentProgram = programMap[program];
//console.log("currentProgram: ", currentProgram)

if (currentProgram) {
const videoNaoAssistido = currentProgram.find((video: IVideo) => !watchedVideos.some((v: IVideo) => v.id === video.id));
Expand All @@ -367,7 +364,6 @@ export class VideoService {

//Assistir Mais Tarde
addToWatchLater(videoId: string, userId: string): Observable<any> {
//console.log(videoId,userId)
return this.http.post(`${this.videoServiceApiURL}/watch-later/`, { video_id: videoId, user_id: userId });
}

Expand All @@ -391,7 +387,6 @@ export class VideoService {

// Favoritar
addToFavorite(videoId: string, userId: string): Observable<any> {
//console.log('Adding to favorite:', videoId, userId)
return this.http.post(`${this.videoServiceApiURL}/favorite/`, { video_id: videoId, user_id: userId });
}

Expand Down

0 comments on commit 2e04299

Please sign in to comment.