fix(core): correct logic for slash command /spend

ref: #284 c#286
This commit is contained in:
2024-09-14 11:20:47 +09:30
parent 7894ac5522
commit d05537a619
2 changed files with 20 additions and 14 deletions

View File

@ -61,25 +61,30 @@ For this command to process the following conditions must be met:
duration += int(seconds[:-1])
if duration > 0:
if duration == 0:
if str(self._meta.verbose_name).lower() == 'ticket':
#ToDo: Add logging that the slash command could not be processed.
from core.models.ticket.ticket_comment import TicketComment
return str(match.string[match.start():match.end()])
comment_text = f'added {time} of time spent'
TicketComment.objects.create(
ticket = self,
comment_type = TicketComment.CommentType.ACTION,
body = comment_text,
duration = duration,
user = self.opened_by,
)
if str(self._meta.verbose_name).lower() == 'ticket':
if str(self._meta.verbose_name).lower() == 'comment':
from core.models.ticket.ticket_comment import TicketComment
self.duration = duration
comment_text = f'added {time} of time spent'
TicketComment.objects.create(
ticket = self,
comment_type = TicketComment.CommentType.ACTION,
body = comment_text,
duration = duration,
user = self.opened_by,
)
elif str(self._meta.verbose_name).lower() == 'comment':
self.duration = duration
else:
@ -87,4 +92,5 @@ For this command to process the following conditions must be met:
return str(match.string[match.start():match.end()])
return None

View File

@ -24,7 +24,7 @@ prepare:
markdown-mkdocs-lint:
PATH=${PATH}:node_modules/.bin markdownlint-cli2 docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md !CHANGELOG.md !gitlab-ci !website-template
PATH=${PATH}:node_modules/.bin markdownlint-cli2 docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md !CHANGELOG.md !gitlab-ci !website-template || true
docs-lint: markdown-mkdocs-lint