Commit 7559e360 by Juho Salli

Merge branch 'devel' of codecrew.fi:bortal into devel

2 parents 90e0e0da 6ef8b6d5
...@@ -29,6 +29,8 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -29,6 +29,8 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbUpdates.add(new String[] { "" }); // first version, no changes dbUpdates.add(new String[] { "" }); // first version, no changes
dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN game integer NOT NULL REFERENCES tournament_games(id)" }); dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN game integer NOT NULL REFERENCES tournament_games(id)" });
dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN rules integer NOT NULL REFERENCES tournament_rules(id)" }); dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN rules integer NOT NULL REFERENCES tournament_rules(id)" });
dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN max_participants integer NOT NULL DEFAULT 0" });
dbUpdates.add(new String[] { "ALTER TABLE tournament_participants ADD COLUMN tournament integer NOT NULL REFERENCES tournaments(id)" });
// dbUpdates.add(new String[] { "ALTER TABLE users ALTER COLUMN birthday TYPE date" }); // dbUpdates.add(new String[] { "ALTER TABLE users ALTER COLUMN birthday TYPE date" });
} }
......
...@@ -221,6 +221,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -221,6 +221,7 @@ public class MenuBean implements MenuBeanLocal {
lognavi.addPage(menuitemfacade.findOrCreate("/actionlog/taskview"), UserPermission.VIEW_ALL).setVisible(false); lognavi.addPage(menuitemfacade.findOrCreate("/actionlog/taskview"), UserPermission.VIEW_ALL).setVisible(false);
MenuNavigation compoMenu = adminevent.addPage(null, null); MenuNavigation compoMenu = adminevent.addPage(null, null);
compoMenu.setKey("topnavi.compos");
compoMenu.addPage(menuitemfacade.findOrCreate("/voting/admincompolist"), CompoPermission.VIEW_COMPOS); compoMenu.addPage(menuitemfacade.findOrCreate("/voting/admincompolist"), CompoPermission.VIEW_COMPOS);
compoMenu.addPage(menuitemfacade.findOrCreate("/voting/create"), CompoPermission.MANAGE); compoMenu.addPage(menuitemfacade.findOrCreate("/voting/create"), CompoPermission.MANAGE);
......
...@@ -43,8 +43,8 @@ public class TournamentBean implements TournamentBeanLocal { ...@@ -43,8 +43,8 @@ public class TournamentBean implements TournamentBeanLocal {
} }
@Override @Override
public void createGame(TournamentGame tg) { public TournamentGame createGame(TournamentGame tg) {
tournamentGameFacade.create(tg); return tournamentGameFacade.create(tg);
} }
@Override @Override
......
...@@ -13,7 +13,7 @@ public interface TournamentBeanLocal { ...@@ -13,7 +13,7 @@ public interface TournamentBeanLocal {
List<TournamentGame> getGames(); List<TournamentGame> getGames();
List<TournamentRule> getRulesByGame(TournamentGame tg); List<TournamentRule> getRulesByGame(TournamentGame tg);
void createGame(TournamentGame tg); TournamentGame createGame(TournamentGame tg);
TournamentRule createRule(TournamentRule tr); TournamentRule createRule(TournamentRule tr);
TournamentGame findGame(Integer id); TournamentGame findGame(Integer id);
TournamentRule findRule(Integer id); TournamentRule findRule(Integer id);
......
...@@ -51,6 +51,7 @@ public class Tournament extends GenericEntity implements Serializable { ...@@ -51,6 +51,7 @@ public class Tournament extends GenericEntity implements Serializable {
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private TournamentStatus tournamentStatus; private TournamentStatus tournamentStatus;
@OneToOne
@JoinColumn(name="tournament_root") @JoinColumn(name="tournament_root")
private TournamentMatch tournamentRoot; private TournamentMatch tournamentRoot;
...@@ -60,9 +61,14 @@ public class Tournament extends GenericEntity implements Serializable { ...@@ -60,9 +61,14 @@ public class Tournament extends GenericEntity implements Serializable {
@Column(name="players_per_team") @Column(name="players_per_team")
private Integer playersPerTeam; private Integer playersPerTeam;
@Column(name="max_participants")
private Integer maxParticipants;
@ManyToOne
@JoinColumn(name="game", nullable=false) @JoinColumn(name="game", nullable=false)
private TournamentGame tournamentGame; private TournamentGame tournamentGame;
@ManyToOne
@JoinColumn(name="rules", nullable=false) @JoinColumn(name="rules", nullable=false)
private TournamentRule rules; private TournamentRule rules;
...@@ -70,6 +76,9 @@ public class Tournament extends GenericEntity implements Serializable { ...@@ -70,6 +76,9 @@ public class Tournament extends GenericEntity implements Serializable {
@OrderBy("id ASC") @OrderBy("id ASC")
private List<Tournament> subTournaments; private List<Tournament> subTournaments;
@OneToMany
private List<TournamentParticipant> participants;
public Tournament() { super(); } public Tournament() { super(); }
public Integer getTalynTournamentId() { public Integer getTalynTournamentId() {
...@@ -182,4 +191,20 @@ public class Tournament extends GenericEntity implements Serializable { ...@@ -182,4 +191,20 @@ public class Tournament extends GenericEntity implements Serializable {
public void setRules(TournamentRule rules) { public void setRules(TournamentRule rules) {
this.rules = rules; this.rules = rules;
} }
public Integer getMaxParticipants() {
return maxParticipants;
}
public void setMaxParticipants(Integer maxParticipants) {
this.maxParticipants = maxParticipants;
}
public List<TournamentParticipant> getParticipants() {
return participants;
}
public void setTournamentParticipants(List<TournamentParticipant> participants) {
this.participants = participants;
}
} }
...@@ -25,6 +25,10 @@ public class TournamentParticipant extends GenericEntity implements Serializable ...@@ -25,6 +25,10 @@ public class TournamentParticipant extends GenericEntity implements Serializable
@OneToMany @OneToMany
private List<EventUser> teamMembers; private List<EventUser> teamMembers;
@ManyToOne
@JoinColumn(name="tournament")
private Tournament tournament;
public TournamentParticipant() { public TournamentParticipant() {
super(); super();
} }
......
...@@ -3,4 +3,16 @@ package fi.codecrew.moya.enums; ...@@ -3,4 +3,16 @@ package fi.codecrew.moya.enums;
public enum TournamentType { public enum TournamentType {
SINGLE_ELIMINATION, SINGLE_ELIMINATION,
DOUBLE_ELIMINATION DOUBLE_ELIMINATION
;
private final String key;
private static final String I18N_HEADER = "bortalApplication.tournament.";
private TournamentType() {
key = I18N_HEADER + name();
}
public String getI18nKey() {
return key;
}
} }
...@@ -77,13 +77,19 @@ ...@@ -77,13 +77,19 @@
<br /> <br />
<h:selectOneMenu value="#{tournamentCreateView.tournament.tournamentType}"> <h:selectOneMenu value="#{tournamentCreateView.tournament.tournamentType}">
<f:selectItems value="#{tournamentCreateView.tournamentTypes}" var="val" itemLabel="#{val}" /> <f:selectItems value="#{tournamentCreateView.tournamentTypes}" var="val" itemLabel="#{i18n[val.i18nKey]}" />
</h:selectOneMenu> </h:selectOneMenu>
<br /> <br />
<h:outputText value="#{i18n['tournaments.players_per_match']}" /> <h:outputText value="#{i18n['tournaments.players_per_match']}" />
<h:panelGrid columns="1" style="margin-bottom:10px"> <h:panelGrid columns="1" style="margin-bottom:10px">
<p:inputText id="playerSlider" value="#{tournamentCreateView.tournament.playersPerMatch}" /> <p:inputText id="maxPartSlider" value="#{tournamentCreateView.tournament.maxParticipants}" />
<p:slider for="maxPartSlider" />
</h:panelGrid>
<h:outputText value="#{i18n['tournaments.players_per_match']}" />
<h:panelGrid columns="1" style="margin-bottom:10px">
<p:inputText id="playerSlider" value="#{tournamentCreateView.tournament.playersPerMatch}" />
<p:slider for="playerSlider" /> <p:slider for="playerSlider" />
</h:panelGrid> </h:panelGrid>
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
</p:column> </p:column>
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['tournament.fillamount']}" />
</f:facet>
<h:outputText value="#{tournament.participants.size()}/#{tournament.maxParticipants}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.playerspermatch_slash_teamsize']}" /> <h:outputText value="#{i18n['tournament.playerspermatch_slash_teamsize']}" />
</f:facet> </f:facet>
<h:outputText value="#{tournament.playersPerMatch}/#{tournament.playersPerTeam}" /> <h:outputText value="#{tournament.playersPerMatch}/#{tournament.playersPerTeam}" />
......
...@@ -76,8 +76,6 @@ ...@@ -76,8 +76,6 @@
</h:dataTable> </h:dataTable>
</h:form> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
...@@ -81,6 +81,7 @@ bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users ...@@ -81,6 +81,7 @@ bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users
bortalApplication.terminal.CASHIER = Access cashier terminal functions bortalApplication.terminal.CASHIER = Access cashier terminal functions
bortalApplication.terminal.CUSTOMER = Access client terminal functions bortalApplication.terminal.CUSTOMER = Access client terminal functions
bortalApplication.terminal.SELFHELP = Self help terminal bortalApplication.terminal.SELFHELP = Self help terminal
bortalApplication.tournament.DOUBLE_ELIMINATION = Double elimination
bortalApplication.tournament.SINGLE_ELIMINATION = Single Elimination bortalApplication.tournament.SINGLE_ELIMINATION = Single Elimination
bortalApplication.user = User permissions bortalApplication.user = User permissions
bortalApplication.user.ANYUSER = All users have this anyways bortalApplication.user.ANYUSER = All users have this anyways
......
...@@ -159,7 +159,6 @@ bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users ...@@ -159,7 +159,6 @@ bortalApplication.shop.SHOP_TO_OTHERS = Shop to other users
bortalApplication.terminal.CASHIER = Access cashier terminal functions bortalApplication.terminal.CASHIER = Access cashier terminal functions
bortalApplication.terminal.CUSTOMER = Access client terminal functions bortalApplication.terminal.CUSTOMER = Access client terminal functions
bortalApplication.terminal.SELFHELP = Self help terminal bortalApplication.terminal.SELFHELP = Self help terminal
bortalApplication.tournament.SINGLE_ELIMINATION = Single Elimination
bortalApplication.user = User permissions bortalApplication.user = User permissions
bortalApplication.user.ANYUSER = All users have this anyways bortalApplication.user.ANYUSER = All users have this anyways
bortalApplication.user.CREATE_NEW = Create new user bortalApplication.user.CREATE_NEW = Create new user
...@@ -929,6 +928,7 @@ submenu.useradmin.listCardTemplates = Card templates ...@@ -929,6 +928,7 @@ submenu.useradmin.listCardTemplates = Card templates
submenu.useradmin.sendPicture = Send a picture submenu.useradmin.sendPicture = Send a picture
submenu.useradmin.showTakePicture = Show webcam submenu.useradmin.showTakePicture = Show webcam
submenu.useradmin.validateUser = Validate user submenu.useradmin.validateUser = Validate user
submenu.voting.admincompolist = Compos
submenu.voting.compolist = Compos submenu.voting.compolist = Compos
submenu.voting.create = Create new compo submenu.voting.create = Create new compo
submenu.voting.myEntries = My entries submenu.voting.myEntries = My entries
......
...@@ -160,7 +160,6 @@ bortalApplication.shop.SHOP_TO_OTHERS = Saa ostaa tuotteita muille ...@@ -160,7 +160,6 @@ bortalApplication.shop.SHOP_TO_OTHERS = Saa ostaa tuotteita muille
bortalApplication.terminal.CASHIER = Muokata rahastusp\u00E4\u00E4tteiden toimintoja bortalApplication.terminal.CASHIER = Muokata rahastusp\u00E4\u00E4tteiden toimintoja
bortalApplication.terminal.CUSTOMER = Muokata k\u00E4vij\u00E4p\u00E4\u00E4tteiden toimintoja bortalApplication.terminal.CUSTOMER = Muokata k\u00E4vij\u00E4p\u00E4\u00E4tteiden toimintoja
bortalApplication.terminal.SELFHELP = Itsepalvelup\u00E4\u00E4te bortalApplication.terminal.SELFHELP = Itsepalvelup\u00E4\u00E4te
bortalApplication.tournament.SINGLE_ELIMINATION = Single Elimination
bortalApplication.user = K\u00E4ytt\u00E4j\u00E4oikeudet bortalApplication.user = K\u00E4ytt\u00E4j\u00E4oikeudet
bortalApplication.user.ANYUSER = AINA kaikilla k\u00E4ytt\u00E4jill\u00E4 bortalApplication.user.ANYUSER = AINA kaikilla k\u00E4ytt\u00E4jill\u00E4
bortalApplication.user.CREATE_NEW = Voi luoda uuden k\u00E4ytt\u00E4j\u00E4n bortalApplication.user.CREATE_NEW = Voi luoda uuden k\u00E4ytt\u00E4j\u00E4n
...@@ -912,6 +911,7 @@ submenu.useradmin.listCardTemplates = Listaa korttipohjat ...@@ -912,6 +911,7 @@ submenu.useradmin.listCardTemplates = Listaa korttipohjat
submenu.useradmin.sendPicture = L\u00E4het\u00E4 kuva submenu.useradmin.sendPicture = L\u00E4het\u00E4 kuva
submenu.useradmin.showTakePicture = N\u00E4yt\u00E4 webcam submenu.useradmin.showTakePicture = N\u00E4yt\u00E4 webcam
submenu.useradmin.validateUser = Validoi k\u00E4ytt\u00E4j\u00E4 submenu.useradmin.validateUser = Validoi k\u00E4ytt\u00E4j\u00E4
submenu.voting.admincompolist = Kilpailut
submenu.voting.compolist = Kilpailut submenu.voting.compolist = Kilpailut
submenu.voting.create = Uusi kilpailu submenu.voting.create = Uusi kilpailu
submenu.voting.myEntries = Omat entryt submenu.voting.myEntries = Omat entryt
...@@ -1131,7 +1131,7 @@ voting.allcompos.submitEntry = L\u00E4het\u00E4 entry ...@@ -1131,7 +1131,7 @@ voting.allcompos.submitEntry = L\u00E4het\u00E4 entry
voting.allcompos.submitStart = Lis\u00E4ys auki voting.allcompos.submitStart = Lis\u00E4ys auki
voting.allcompos.voteEnd = \u00C4\u00E4nestys kiinni voting.allcompos.voteEnd = \u00C4\u00E4nestys kiinni
voting.allcompos.voteStart = \u00C4\u00E4nestys auki voting.allcompos.voteStart = \u00C4\u00E4nestys auki
voting.compo.submit = L\u00E4het\u00E4 kappale voting.compo.submit = L\u00E4het\u00E4 teos
voting.compo.vote = \u00C4\u00E4nest\u00E4 voting.compo.vote = \u00C4\u00E4nest\u00E4
voting.compoentryadd.button = L\u00E4het\u00E4 voting.compoentryadd.button = L\u00E4het\u00E4
voting.compoentryadd.description = Ilmoittaudu kilpailuun: voting.compoentryadd.description = Ilmoittaudu kilpailuun:
......
...@@ -50,11 +50,13 @@ public class TournamentCreateView extends GenericCDIView { ...@@ -50,11 +50,13 @@ public class TournamentCreateView extends GenericCDIView {
this.beginConversation(); this.beginConversation();
tournament = new Tournament(); tournament = new Tournament();
tournament.setPlayersPerMatch(0); tournament.setPlayersPerMatch(0);
tournament.setMaxParticipants(0);
backupPlayers = 0; backupPlayers = 0;
tournamentGames = tournamentBean.getGames(); tournamentGames = tournamentBean.getGames();
} }
} }
public String save() { public String save() {
tournament.setPlayersPerTeam(tournament.getPlayersPerMatch() + backupPlayers); tournament.setPlayersPerTeam(tournament.getPlayersPerMatch() + backupPlayers);
tournament.setLanEvent(eventBean.getCurrentEvent()); tournament.setLanEvent(eventBean.getCurrentEvent());
...@@ -95,7 +97,7 @@ public class TournamentCreateView extends GenericCDIView { ...@@ -95,7 +97,7 @@ public class TournamentCreateView extends GenericCDIView {
tg.setDescription(tournamentGameDescription); tg.setDescription(tournamentGameDescription);
tg.setLanEvent(eventBean.getCurrentEvent()); tg.setLanEvent(eventBean.getCurrentEvent());
tournamentBean.createGame(tg); game = tournamentBean.createGame(tg);
} }
tournamentRules = tournamentBean.getRulesByGame(game); tournamentRules = tournamentBean.getRulesByGame(game);
......
package fi.codecrew.moya.web.cdiview.tournaments;
public class TournamentListView {
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!