Skip to content

Commit

Permalink
make an info log if paper has already been added
Browse files Browse the repository at this point in the history
  • Loading branch information
tmwclaxton committed Jan 6, 2024
1 parent b97bb3f commit cba4bc9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/dispatcher/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func handleFail(s *store.Store, cacheSvc *helpers.CacheHelper, message *sqs.Mess

UserMessage: fmt.Sprintf("Error processing file: %s", s3Location),
FullLog: err.Error(),
Stage: "paper_processing",
Stage: "pdf_processing",
UserID: userID,
ScreenID: screenID,
}
Expand Down Expand Up @@ -319,8 +319,20 @@ func processMessage(id int, message *sqs.Message, svc *sqs.SQS, sqsURL, s3Bucket
logging.InfoLogger.Printf("Created paper: %v\n", paper.ID)
}
} else {
log.Printf("Found paper: %v\n", paper.ID)
paperAlreadyExists = true
log.Printf("Found paper: %v\n", paper.ID)
logEntry := store.Log{
Level: "info",
UserMessage: fmt.Sprintf("Ignore if you uploaded a csv first. Paper has already been added: %v", paper.Title),
FullLog: "",
Stage: "pdf_processing",
UserID: userID,
ScreenID: screenID,
}
err := s.SaveLog(logEntry)
if err != nil {
return err
}
}

// ---- Sections ----
Expand Down

0 comments on commit cba4bc9

Please sign in to comment.