Skip to content

Commit 41667e3

Browse files
committed
use time of creation/modfication from thread and tags as csv
1 parent dcf9a7a commit 41667e3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

application/src/main/java/org/togetherjava/tjbot/features/help/HelpSystemHelper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,18 @@ private RestAction<Message> useChatGptFallbackMessage(ThreadChannel threadChanne
204204

205205
void writeHelpThreadToDatabase(long authorId, ThreadChannel threadChannel) {
206206

207-
Instant createdAt = Instant.now();
208-
String tag = threadChannel.getAppliedTags().getFirst().getName();
207+
Instant createdAt = threadChannel.getTimeCreated().toInstant();
208+
List<String> tagsList =
209+
threadChannel.getAppliedTags().stream().map(ForumTag::getName).toList();
210+
211+
String tags = String.join(", ", tagsList);
209212

210213
database.write(content -> {
211214
HelpThreadsRecord helpThreadsRecord = content.newRecord(HelpThreads.HELP_THREADS)
212215
.setAuthorId(authorId)
213216
.setChannelId(threadChannel.getIdLong())
214217
.setCreatedAt(createdAt)
215-
.setTag(tag)
218+
.setTag(tags)
216219
.setTicketStatus(TicketStatus.ACTIVE.val);
217220
if (helpThreadsRecord.update() == 0) {
218221
helpThreadsRecord.insert();

application/src/main/java/org/togetherjava/tjbot/features/help/HelpThreadLifecycleListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void onChannelUpdateAppliedTags(@NotNull ChannelUpdateAppliedTagsEvent ev
6464
}
6565

6666
private void handleThreadStatus(ThreadChannel threadChannel) {
67-
Instant closedAt = Instant.now();
67+
Instant closedAt = threadChannel.getTimeArchiveInfoLastModified().toInstant();
6868
long threadId = threadChannel.getIdLong();
6969

7070
int status = database.read(context -> context.selectFrom(HELP_THREADS)

0 commit comments

Comments
 (0)