Merge pull request #6 from Arimihanta/main

Regler problème sur vote majoritaire
This commit is contained in:
ArenMg 2021-07-14 13:55:23 +03:00 committed by GitHub
commit 751ee3247f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 51 deletions

View file

@ -27,11 +27,11 @@ public class VMVote extends AbstractEntity implements Serializable {
EXCELLENT
}
@ManyToOne(fetch = FetchType.LAZY)
@ManyToOne
@JoinColumn(name = "subThemeId")
private VMChoice subThemeId;
@ManyToOne(fetch = FetchType.LAZY)
@ManyToOne
@JoinColumn(name = "authorId")
private User authorId ;

View file

@ -63,6 +63,31 @@ public class VMThemeRESTFacade extends AbstractRESTFacade<VMTheme>{
themes.forEach(theme -> {
this.orderChoices(theme);
newThemes.add(theme) ;
});
return newThemes ;
}
@DELETE
@Path("delete/{id}")
@RolesAllowed({"ADMIN"})
public void delete(@PathParam("id") Long id) {
themeService.delete(id);
}
@Override
//@RolesAllowed({"MODO"})
@PermitAll
public VMTheme find(Long id) {
boolean withChoices = this.overview == null;
VMTheme theme = themeService.find(id,withChoices,true);
this.orderChoices(theme);
return theme;
}
private void orderChoices(VMTheme theme){
Object []choices=theme.getChoices().toArray() ;
List<VMChoice> choicesNotVoted=new ArrayList<>() ;
List<ProposalTallyInterface> proposalTallyInterfaces=new ArrayList<>() ;
@ -111,26 +136,5 @@ public class VMThemeRESTFacade extends AbstractRESTFacade<VMTheme>{
}
theme.setChoices(setChoices);
newThemes.add(theme) ;
});
return newThemes ;
}
@DELETE
@Path("delete/{id}")
@RolesAllowed({"ADMIN"})
public void delete(@PathParam("id") Long id) {
themeService.delete(id);
}
@Override
//@RolesAllowed({"MODO"})
@PermitAll
public VMTheme find(Long id) {
boolean withChoices = this.overview == null;
VMTheme theme = themeService.find(id,withChoices,true);
return theme;
}
}