Minor updates

- Updating readme with useful command.
- Checking in a missed logger update and some minor formatting.
- Checking in some useful sql scripts
- Fixing a minor site issue with unit tests
This commit is contained in:
Christian 'ketura' McCarty
2024-04-12 22:00:58 -05:00
parent bb6c7a0b6b
commit 759f4cbc58
8 changed files with 133 additions and 12 deletions

View File

@@ -0,0 +1,76 @@
SELECT *
FROM player p
WHERE name = 'Neilpie'
SELECT *
FROM deck d
INNER JOIN player p
ON p.id = d.player_id
WHERE p.name = 'Neilpie'
SELECT *
FROM game_history gh
WHERE winner = 'Neilpie' OR loser = 'Neilpie'
SELECT *
FROM deck d
INNER JOIN player p
ON p.id = d.player_id
WHERE p.name IN ('Axter', 'balrog69', 'bign19', 'CoS', 'dstaley', 'enolen', 'fnlgroove', 'GeriGeli', 'Icarus', 'johnec', 'LukasSchor', 'MockingbirdME', 'neergreve', 'olga06', 'Pokec', 'Raelag', 'rbranco', 'Ringbearer', 'stephan77', 'talial', 'thedast7', 'Tonio', 'Yk1030')
AND contents LIKE '%1_382%'
SELECT *
FROM transfer t
WHERE collection LIKE '%1_382%'
ORDER BY id DESC
SELECT *
FROM collection c
INNER JOIN collection_entries ce
ON ce.collection_id = c.id
INNER JOIN player p
ON p.id = c.player_id
WHERE #p.name = 'Chadwick537' AND
product IN('1_382', '1_382*')
AND p.name IN ('Axter', 'balrog69', 'bign19', 'CoS', 'dstaley', 'enolen', 'fnlgroove', 'GeriGeli', 'Icarus', 'johnec', 'LukasSchor', 'MockingbirdME', 'neergreve', 'olga06', 'Pokec', 'Raelag', 'rbranco', 'Ringbearer', 'stephan77', 'talial', 'thedast7', 'Tonio', 'Yk1030')
AND ce.created_date <> ce.modified_date
AND (c.type <> 'trophy')
ORDER BY p.name, ce.modified_date, ce.created_date DESC
-- INSERT INTO gemp_db.collection_entries
-- (collection_id, quantity, product_type, product_variant, product, source, created_date, modified_date, notes)
-- VALUES
-- (38751, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (63570, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (22671, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (64330, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (167019, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (55829, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (167461, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (103237, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (65411, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (59343, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (62630, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (94793, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (58444, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (273741, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (59369, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision'),
-- (23215, 4, 'CARD', NULL, '1_386', 'Manual Administrator action', current_timestamp(), NULL, 'Fixing the 2023 WC Goblin Runner / FA Enquea collision')
-- ;
-- UPDATE collection_entries
-- SET quantity = quantity - 4
-- WHERE product = '1_382'
-- AND collection_id IN (38751, 63570, 22671, 64330, 167019, 55829, 167461, 103237, 65411, 59343, 62630, 94793, 58444, 273741, 59369, 23215)
#SELECT *
#FROM collection_entries ce
WHERE collection_id = 199929 AND product = '1_383'

View File

@@ -0,0 +1,32 @@
-- SELECT *
-- FROM game_history gh
-- WHERE tournament LIKE '%Yuletide%'
-- AND (winner = 'm_scarpato' OR loser = 'm_scarpato')
--
# Get IDs from the appropriate yuletide leagues:
SELECT *
FROM league l
WHERE name LIKE '%Yuletide%'
ORDER BY id DESC;
# Stick those IDs in both of these clauses:
SELECT player, count(*) AS matches
FROM (
SELECT winner AS player
FROM league_match w
WHERE w.league_type IN ('1702871717631', '1702871696832', '1702871668557')
UNION ALL
SELECT loser AS player
FROM league_match l
WHERE l.league_type IN ('1702871717631', '1702871696832', '1702871668557')
) players
GROUP BY players.player
ORDER BY COUNT(*) DESC

View File

@@ -70,6 +70,12 @@ gemp_app is slightly more complicated. Gemp is a Java server, is built using Ma
At this point, editing the code is a matter of changing the files on your local machine and either re-running step 9, or re-compiling the code base in your IDE of choice. At this point, editing the code is a matter of changing the files on your local machine and either re-running step 9, or re-compiling the code base in your IDE of choice.
Run the following commands to ensure that you don't have local configuration showing up in your commits:
1. `git update-index --assume-unchanged ./logs/nohup.out`
2. `git update-index --assume-unchanged ./gemp-lotr/docker/docker-compose.yml`
3. `git update-index --assume-unchanged ./gemp-lotr/docker/gemp_app.Dockerfile`
(If you do indeed need to alter those files, repeat the above commands but use the `--no-assume-unchanged` flag instead.)

View File

@@ -93,12 +93,11 @@ public class GempukkuHttpRequestHandler extends SimpleChannelInboundHandler<Full
} }
} catch (HttpProcessingException exp) { } catch (HttpProcessingException exp) {
int code = exp.getStatus(); int code = exp.getStatus();
//401, 403, 404, and other 400 errors should just do minimal logging, //401, 403, 404, and other 400-series errors should just do minimal logging,
// but 400 itself should error out
if(code % 400 < 100 && code != 400) { if(code % 400 < 100 && code != 400) {
_log.debug("HTTP " + code + " response for " + requestInformation.remoteIp + ": " + requestInformation.uri); _log.debug("HTTP " + code + " response for " + requestInformation.remoteIp + ": " + requestInformation.uri);
} }
// record an HTTP 400 // but 400 itself should error out
else if(code == 400 || code % 500 < 100) { else if(code == 400 || code % 500 < 100) {
_log.error("HTTP code " + code + " response for " + requestInformation.remoteIp + ": " + requestInformation.uri, exp); _log.error("HTTP code " + code + " response for " + requestInformation.remoteIp + ": " + requestInformation.uri, exp);
} }

View File

@@ -295,10 +295,10 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
for (String playerName : playerNames) { for (String playerName : playerNames) {
Player player = _playerDao.getPlayer(playerName); Player player = _playerDao.getPlayer(playerName);
_collectionManager.addItemsToPlayerCollection(true, "Administrator action", player, createCollectionType(collectionType), productItems); _collectionManager.addItemsToPlayerCollection(true, "Administrator action", player, createCollectionType(collectionType), productItems);
} }
responseWriter.writeHtmlResponse("OK"); responseWriter.writeHtmlResponse("OK");
} finally { } finally {
postDecoder.destroy(); postDecoder.destroy();
} }
@@ -818,6 +818,13 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
responseWriter.writeHtmlResponse("Before: " + before + "<br><br>After: " + after); responseWriter.writeHtmlResponse("Before: " + before + "<br><br>After: " + after);
} }
private void clearCache() throws SQLException, IOException {
_leagueService.clearCache();
_tournamentService.clearCache();
_cacheManager.clearCaches();
_hallServer.cleanup(true);
}
private void validateAdmin(HttpRequest request) throws HttpProcessingException { private void validateAdmin(HttpRequest request) throws HttpProcessingException {
Player player = getResourceOwnerSafely(request, null); Player player = getResourceOwnerSafely(request, null);

View File

@@ -34,11 +34,11 @@ public class ChatRoomMediator {
this.welcomeMessage = welcomeMessage; this.welcomeMessage = welcomeMessage;
} }
public ChatRoomMediator(IgnoreDAO ignoreDAO, PlayerDAO playerDAO, String roomName, boolean muteJoinPartMessages, int secondsTimeoutPeriod, Set<String> allowedPlayers, public ChatRoomMediator(IgnoreDAO ignoreDAO, PlayerDAO playerDAO, String roomName, boolean muteJoinPartMessages,
boolean allowIncognito) { int secondsTimeoutPeriod, Set<String> allowedPlayers, boolean allowIncognito) {
this.ignoreDAO = ignoreDAO; this.ignoreDAO = ignoreDAO;
this.playerDAO = playerDAO; this.playerDAO = playerDAO;
_logger = Logger.getLogger("chat."+roomName); _logger = LogManager.getLogger("chat."+roomName);
_allowedPlayers = allowedPlayers; _allowedPlayers = allowedPlayers;
_channelInactivityTimeoutPeriod = 1000 * secondsTimeoutPeriod; _channelInactivityTimeoutPeriod = 1000 * secondsTimeoutPeriod;
_chatRoom = new ChatRoom(muteJoinPartMessages, allowIncognito); _chatRoom = new ChatRoom(muteJoinPartMessages, allowIncognito);

View File

@@ -19,7 +19,8 @@ public class ChatServer extends AbstractServer {
this.playerDAO = playerDAO; this.playerDAO = playerDAO;
} }
public ChatRoomMediator createChatRoom(String name, boolean muteJoinPartMessages, int secondsTimeoutPeriod, boolean allowIncognito, String welcomeMessage) { public ChatRoomMediator createChatRoom(String name, boolean muteJoinPartMessages, int secondsTimeoutPeriod,
boolean allowIncognito, String welcomeMessage) {
ChatRoomMediator chatRoom = new ChatRoomMediator(ignoreDAO, playerDAO, name, muteJoinPartMessages, secondsTimeoutPeriod, allowIncognito, welcomeMessage); ChatRoomMediator chatRoom = new ChatRoomMediator(ignoreDAO, playerDAO, name, muteJoinPartMessages, secondsTimeoutPeriod, allowIncognito, welcomeMessage);
try { try {
chatRoom.sendMessage("System", "Welcome to room: " + name, true); chatRoom.sendMessage("System", "Welcome to room: " + name, true);

View File

@@ -32,7 +32,7 @@ public class GenericCardTestHelper extends AbstractAtTest {
put("site3", "1_337"); put("site3", "1_337");
put("site4", "1_343"); put("site4", "1_343");
put("site5", "1_349"); put("site5", "1_349");
put("site6", "1_350"); put("site6", "1_351");
put("site7", "1_353"); put("site7", "1_353");
put("site8", "1_356"); put("site8", "1_356");
put("site9", "1_360"); put("site9", "1_360");