Ensure latest created report is fetch
This commit is contained in:
parent
52f43c6bc5
commit
38b2be58fe
1 changed files with 1 additions and 1 deletions
|
|
@ -108,7 +108,7 @@ func (s *DBStorage) ReportExists(testID uuid.UUID) (bool, error) {
|
|||
// GetReport retrieves a report by test ID, returning the raw JSON and email bytes
|
||||
func (s *DBStorage) GetReport(testID uuid.UUID) ([]byte, []byte, error) {
|
||||
var dbReport Report
|
||||
if err := s.db.First(&dbReport, "test_id = ?", testID).Error; err != nil {
|
||||
if err := s.db.Where("test_id = ?", testID).Order("created_at DESC").First(&dbReport).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, nil, ErrNotFound
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue