Skip to content

Commit 568b3c6

Browse files
authored
[CO-293] Fix before a production run. (#12)
I decided to merge this since I want to create a develop branch ASAP.
1 parent 1370df6 commit 568b3c6

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/Zendesk.hs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ defaultConfig =
7575
, cfgAssignTo = 0
7676
, cfgKnowledgebase = []
7777
, cfgNumOfLogsToAnalyze = 5
78-
, cfgIsCommentPublic = False -- TODO(ks): For now, we need this in CLI.
78+
, cfgIsCommentPublic = True -- TODO(ks): For now, we need this in CLI.
7979
}
8080

8181
-- | Path to knowledgebase
@@ -231,7 +231,7 @@ processTicketAndId ticketInfo@TicketInfo{..} = do
231231
-- | Inspect attachment then post comment to the ticket
232232
inspectAttachmentAndPostComment :: TicketInfo -> Attachment -> App ()
233233
inspectAttachmentAndPostComment ticketInfo@TicketInfo{..} attachment = do
234-
liftIO $ putTextLn $ "Analyzing ticket id: " <> show ticketId
234+
liftIO $ putTextLn $ "Analyzing ticket: " <> show ticketInfo
235235
zendeskResponse <- inspectAttachment ticketInfo attachment
236236

237237
let comment = zrComment zendeskResponse
@@ -254,8 +254,10 @@ inspectAttachment ticketInfo att = do
254254
let results = extractLogsFromZip cfgNumOfLogsToAnalyze rawlog
255255

256256
case results of
257-
Left err -> do
258-
liftIO $ putTextLn $ "Error parsing zip: " <> err
257+
Left _ -> do
258+
259+
liftIO . putStrLn . renderErrorCode $ SentLogCorrupted
260+
259261
pure ZendeskResponse
260262
{ zrComment = prettyFormatLogReadError ticketInfo
261263
, zrTags = [renderErrorCode SentLogCorrupted]
@@ -270,9 +272,8 @@ inspectAttachment ticketInfo att = do
270272
let errorCodes = extractErrorCodes analysisResult
271273
let commentRes = prettyFormatAnalysis analysisResult ticketInfo
272274

273-
let fErrorCode = foldr (\errorCode acc -> acc <> ";" <> errorCode) "" errorCodes
275+
let fErrorCode = foldr (\errorCode acc -> errorCode <> ";" <> acc) "" errorCodes
274276

275-
liftIO . putTextLn . show $ ticketInfo
276277
liftIO . putTextLn $ fErrorCode
277278

278279
pure ZendeskResponse
@@ -281,8 +282,10 @@ inspectAttachment ticketInfo att = do
281282
, zrIsPublic = cfgIsCommentPublic
282283
}
283284

284-
Left noResult -> do
285-
liftIO $ putStrLn noResult
285+
Left _ -> do
286+
287+
liftIO . putStrLn . renderTicketStatus $ NoKnownIssue
288+
286289
pure ZendeskResponse
287290
{ zrComment = prettyFormatNoIssues ticketInfo
288291
, zrTags = [renderTicketStatus NoKnownIssue]
@@ -306,7 +309,7 @@ filterAnalyzedTickets ticketsInfo =
306309

307310
-- | If we have a ticket we are having issues with...
308311
isTicketBlacklisted :: TicketInfo -> Bool
309-
isTicketBlacklisted TicketInfo{..} = ticketId `notElem` [10815]
312+
isTicketBlacklisted TicketInfo{..} = ticketId `notElem` [9377,10815]
310313

311314

312315
-- | Get single ticket info.

0 commit comments

Comments
 (0)