Skip to content

Commit

Permalink
make encoding list more like real encoding list
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Jan 23, 2024
1 parent c057daf commit 4269ead
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controllers/GetEncodingFilesController.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func GetEncodingFiles(c echo.Context) error {
).
Where("links.user_id = ?", userId).
Joins("JOIN files ON files.id = links.file_id").
Joins("JOIN qualities ON files.id = qualities.file_id AND qualities.encoding = ? AND qualities.failed = ? AND qualities.ready = ?", true, false, false).
Joins("JOIN qualities ON files.id = qualities.file_id AND qualities.failed = ? AND qualities.ready = ?", false, false).
Order("files.id ASC").
Scan(&resQuality).Error; err != nil {
c.Logger().Error("Failed to list encoding files", err)
return c.NoContent(http.StatusInternalServerError)
Expand All @@ -51,7 +52,8 @@ func GetEncodingFiles(c echo.Context) error {
).
Where("links.user_id = ?", userId).
Joins("JOIN files ON files.id = links.file_id").
Joins("JOIN audios ON files.id = audios.file_id AND audios.encoding = ? AND audios.failed = ? AND audios.ready = ?", true, false, false).
Joins("JOIN audios ON files.id = audios.file_id AND audios.failed = ? AND audios.ready = ?", false, false).
Order("files.id ASC").
Scan(&resAudio).Error; err != nil {
c.Logger().Error("Failed to list encoding files", err)
return c.NoContent(http.StatusInternalServerError)
Expand All @@ -68,7 +70,8 @@ func GetEncodingFiles(c echo.Context) error {
).
Where("links.user_id = ?", userId).
Joins("JOIN files ON files.id = links.file_id").
Joins("JOIN subtitles ON files.id = subtitles.file_id AND subtitles.encoding = ? AND subtitles.failed = ? AND subtitles.ready = ?", true, false, false).
Joins("JOIN subtitles ON files.id = subtitles.file_id AND subtitles.failed = ? AND subtitles.ready = ?", false, false).
Order("files.id ASC").
Scan(&resSubtitle).Error; err != nil {
c.Logger().Error("Failed to list encoding files", err)
return c.NoContent(http.StatusInternalServerError)
Expand Down

0 comments on commit 4269ead

Please sign in to comment.