Only update forum posts if post id was found

This commit is contained in:
2021-06-22 16:13:37 +02:00
parent 952f869f59
commit 1c99d0a468

View File

@@ -27,10 +27,12 @@ public class MatchesListForumUpdater {
MatchesListCreator creator = new MatchesListCreator(league); MatchesListCreator creator = new MatchesListCreator(league);
String content = creator.getMatchesBeautiful(); String content = creator.getMatchesBeautiful();
String contentWithCodeBBCode = "<r><CODE><s>[code]</s>" + content + "<e>[/code]</e></CODE></r>"; String contentWithCodeBBCode = "<r><CODE><s>[code]</s>" + content + "<e>[/code]</e></CODE></r>";
int postId = getPostId(creator.getCountry(), creator.getLeagueName()); Integer postId = getPostId(creator.getCountry(), creator.getLeagueName());
if(postId != null) {
TippligaSQLConnector con = TippligaSQLConnector.getInstance(); TippligaSQLConnector con = TippligaSQLConnector.getInstance();
con.updatePost(postId, contentWithCodeBBCode); con.updatePost(postId, contentWithCodeBBCode);
} }
}
private Integer getPostId(String country, String league) { private Integer getPostId(String country, String league) {
String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "';"; String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "';";