Changeset 8f1b7e9 in Git for src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java
- Timestamp:
- 02/10/22 13:28:00 (3 years ago)
- Branches:
- main
- Children:
- 980eeda
- Parents:
- 6f91f99
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java
r6f91f99 r8f1b7e9 45 45 46 46 */ 47 List<Discussion> discussions = discussionService.listAllByTitle(titleSearch); 47 //List<Discussion> discussions = discussionService.listAllByTitle(titleSearch); 48 List<Discussion> discussions = discussionService.listAll(); 48 49 model.addAttribute("discussions", discussions); 49 50 model.addAttribute("contentTemplate", "discussionsList"); 50 51 model.addAttribute("user",LoggedUser.getLoggedUser()); 51 52 this.addModelPropertiesForUser(model); 52 this.addModelPropertiesLikes(model,null, discussions);53 // this.addModelPropertiesLikes(model,null, discussions); 53 54 return "template"; 54 55 } … … 63 64 try { 64 65 Discussion disc = discussionService.findById(id); 65 disc.setLikes(discussionService.findLikesForDiscussionWithId(disc.getDiscussionId()).getLikes());66 66 model.addAttribute("disc", disc); 67 67 model.addAttribute("contentTemplate", "discussion"); … … 185 185 // ispagja kompliciran kod vaka, podobro da dodademe i svojstvo u diskusijata i koga ke se dodade lajk 186 186 // soodvetno da se zgoleme i obratno 187 if(discussion==null){188 List<DiscussionLikesQM> discussionLikes = new ArrayList<>();189 for(Discussion d: discussions){190 discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId()));191 }192 model.addAttribute("likes", discussionLikes);193 }194 else{195 model.addAttribute("likes",discussionService.findLikesForDiscussionWithId(discussion.getDiscussionId()).getLikes());196 }187 // if(discussion==null){ 188 // List<DiscussionLikesQM> discussionLikes = new ArrayList<>(); 189 // for(Discussion d: discussions){ 190 // discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId())); 191 // } 192 // model.addAttribute("likes", discussionLikes); 193 // } 194 // else{ 195 // model.addAttribute("likes",discussionService.findLikesForDiscussionWithId(discussion.getDiscussionId()).getLikes()); 196 // } 197 197 } 198 198
Note:
See TracChangeset
for help on using the changeset viewer.