card lock bei tradingDeal Create

This commit is contained in:
Georg Reisinger 2020-12-30 15:19:06 +01:00
parent 6b8f84a262
commit 3e8003ab50
2 changed files with 2 additions and 5 deletions

View File

@ -46,6 +46,7 @@ public class DBConnection {
* @return true bei erfolg, sonst false
*/
public boolean updateCardLock(String name, boolean lock){
System.out.println("Update user_cards set gesperrt = " + lock + " where name = \'" + name + "\';");
return PostgresHelper.executeUpdate("Update user_cards set gesperrt = " + lock + " where name = \'" + name + "\';");
}

View File

@ -286,17 +286,13 @@ public class Response {
if (tradingDeal != null) {
String tradingJson = JsonHelper.objToJson(tradingDeal);
if (tradingDeal != null) {
//DB Trading deal add
// Lock Card for deck
//Wenn card im deck, dann del aus deck
//new DBConnection().;
ArrayList<String> deckCards = new DBConnection().getDeck(username);
if (deckCards != null) {
if (deckCards.contains(cardtotrade)) {
new DBConnection().delDeck(username);
}
if(new DBConnection().addTradingdeal(tradingDeal.getUsername(), tradingDeal.getId(), tradingDeal.getRequiredMinDamage(), tradingDeal.getRequiredCardType().name(), tradingDeal.getRequiredElementType().name(), tradingDeal.getCardToTrade().getName())){
if(new DBConnection().updateCardLock(tradingDeal.getUsername(), true)){
if(new DBConnection().updateCardLock(tradingDeal.getCardToTrade().getName(), true)){
sendResponse(JsonHelper.objToJson(tradingDeal), "201");
}else{
sendError("500");