Skip to content

Commit

Permalink
Remove torrent_contents AfterFind
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdigital committed May 30, 2024
1 parent ad6d609 commit 0a80219
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions internal/model/torrent_contents.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@ package model
import (
"fmt"
"github.com/bitmagnet-io/bitmagnet/internal/database/fts"
"gorm.io/gorm"
"strings"
)

func (tc *TorrentContent) AfterFind(*gorm.DB) error {
// the following is a mitigation following the v0.9.0 release where seeders, leechers and size are sourced from the torrent_contents table
// because these fields won't be available until after reprocessing, calculate the values here if they are missing;
// it should be removed at some point
if !tc.Seeders.Valid && !tc.Leechers.Valid {
tc.Seeders = tc.Torrent.Seeders()
tc.Leechers = tc.Torrent.Leechers()
}
if tc.Size == 0 {
tc.Size = tc.Torrent.Size
}
return nil
}

func (tc TorrentContent) InferID() string {
parts := make([]string, 4)
parts[0] = tc.InfoHash.String()
Expand Down

0 comments on commit 0a80219

Please sign in to comment.