Changeset 6f91f99 in Git for src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java
- Timestamp:
- 02/09/22 15:46:58 (3 years ago)
- Branches:
- main
- Children:
- 8f1b7e9
- Parents:
- 967b414
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/web/controller/DiscussionController.java
r967b414 r6f91f99 6 6 import com.wediscussmovies.project.model.User; 7 7 import com.wediscussmovies.project.model.relation.DiscussionLikes; 8 import com.wediscussmovies.project.querymodels.DiscussionLikesQM; 8 9 import com.wediscussmovies.project.service.DiscussionService; 9 10 import com.wediscussmovies.project.service.MovieService; … … 62 63 try { 63 64 Discussion disc = discussionService.findById(id); 65 disc.setLikes(discussionService.findLikesForDiscussionWithId(disc.getDiscussionId()).getLikes()); 64 66 model.addAttribute("disc", disc); 65 67 model.addAttribute("contentTemplate", "discussion"); 66 model.addAttribute("user",LoggedUser.getLoggedUser());67 68 model.addAttribute("replies",this.replyService.findAllByDiscussion(disc)); 68 addModelPropertiesLikes(model, disc, null);69 69 addModelPropertiesForUser(model); 70 70 … … 183 183 } 184 184 private void addModelPropertiesLikes(Model model, Discussion discussion, List<Discussion> discussions){ 185 // ispagja kompliciran kod vaka, podobro da dodademe i svojstvo u diskusijata i koga ke se dodade lajk 186 // soodvetno da se zgoleme i obratno 185 187 if(discussion==null){ 186 List< com.wediscussmovies.project.querymodels.DiscussionLikes> discussionLikes = new ArrayList<>();188 List<DiscussionLikesQM> discussionLikes = new ArrayList<>(); 187 189 for(Discussion d: discussions){ 188 190 discussionLikes.add(discussionService.findLikesForDiscussionWithId(d.getDiscussionId()));
Note:
See TracChangeset
for help on using the changeset viewer.