mirror of
https://github.com/ArenMg/aren.git
synced 2024-12-22 23:13:29 +00:00
Merge pull request #6 from Arimihanta/main
Regler problème sur vote majoritaire
This commit is contained in:
commit
751ee3247f
2 changed files with 55 additions and 51 deletions
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue