Небольшие исправления

This commit is contained in:
upagge 2020-04-03 11:32:30 +03:00
parent 2ae8aa816c
commit 2d1fd3f8e4
No known key found for this signature in database
GPG Key ID: 15CD012E46F6BA34
2 changed files with 4 additions and 19 deletions

View File

@ -50,7 +50,7 @@ public class SchedulerComments {
long count = 0;
do {
int page = 0;
Page<PullRequest> pullRequestPage = pullRequestsService.getAll(Pagination.of(page++, COUNT));
Page<PullRequest> pullRequestPage = pullRequestsService.getAll(Pagination.of(page, COUNT));
while (pullRequestPage.hasContent()) {
for (PullRequest pullRequest : pullRequestPage.getContent()) {
final String commentUrl = getCommentUrl(commentId, pullRequest);
@ -63,7 +63,7 @@ public class SchedulerComments {
break;
}
}
pullRequestPage = pullRequestsService.getAll(Pagination.of(page++, COUNT));
pullRequestPage = pullRequestsService.getAll(Pagination.of(++page, COUNT));
}
count++;
commentId += 1;
@ -98,8 +98,6 @@ public class SchedulerComments {
comment.getAnswers().addAll(answerJsons.stream().map(CommentJson::getId).collect(Collectors.toList()));
commentService.save(comment);
}
} else {
commentService.delete(comment.getId());
}
}
}
@ -123,22 +121,9 @@ public class SchedulerComments {
}
private void notification(@NonNull CommentJson comment, @NonNull PullRequest pullRequest) {
// notificationAuthorPr(comment, pullRequest);
notificationPersonal(comment, pullRequest);
}
private void notificationAuthorPr(@NonNull CommentJson comment, @NonNull PullRequest pullRequest) {
final Long authorTelegram = pullRequest.getAuthor().getTelegramId();
if (authorTelegram != null) {
messageSendService.add(
MessageSend.builder()
.telegramId(authorTelegram)
.message(Message.commentPr(comment, pullRequest.getName(), pullRequest.getUrl()))
.build()
);
}
}
private void notificationPersonal(@NonNull CommentJson comment, @NonNull PullRequest pullRequest) {
Matcher matcher = PATTERN.matcher(comment.getText());
while (matcher.find()) {

View File

@ -6,7 +6,7 @@
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>scanner-logs.log</file>
<file>bitbucketbot-logs.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>bitbucket.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>10</maxHistory>
@ -18,7 +18,7 @@
</appender>
<root level="info">
<!-- <appender-ref ref="STDOUT"/>-->
<appender-ref ref="FILE"/>
</root>
</configuration>