Skip to content

Commit

Permalink
Include stats in package list only
Browse files Browse the repository at this point in the history
  • Loading branch information
patapancakes committed Nov 17, 2024
1 parent d7fc1bc commit a82da00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions db/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func FetchPackageLatestRevision(id int) (int, error) {

func FetchPackage(id int, rev int) (common.Package, error) {
var pkg common.Package
err := handle.QueryRow("SELECT id, rev, type, name, dataname, author, description, downloads, favorites, goods, bads, data FROM packages WHERE id = ? AND rev = ?", id, rev).Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.Description, &pkg.Downloads, &pkg.Favorites, &pkg.Goods, &pkg.Bads, &pkg.Data)
err := handle.QueryRow("SELECT id, rev, type, name, dataname, author, description, data FROM packages WHERE id = ? AND rev = ?", id, rev).Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.Description, &pkg.Data)
if err != nil {
return pkg, err
}
Expand Down Expand Up @@ -99,7 +99,7 @@ func FetchPackage(id int, rev int) (common.Package, error) {

func FetchPackageList(category string, author string, search string, offset int, count int, sort string, safemode bool) ([]common.Package, error) {
var args []any
q := "SELECT p.id, p.rev, p.type, p.name, p.dataname, p.author, IFNULL(profiles.personaname, p.legacyauthor), IFNULL(profiles.avatarmedium, \"\"), p.description, p.time FROM packages p LEFT JOIN profiles ON p.author = profiles.steamid WHERE p.rev = (SELECT MAX(p2.rev) FROM packages p2 WHERE p2.id = p.id)"
q := "SELECT p.id, p.rev, p.type, p.name, p.dataname, p.author, IFNULL(profiles.personaname, p.legacyauthor), IFNULL(profiles.avatarmedium, \"\"), p.description, p.downloads, p.favorites, p.goods, p.bads, p.time FROM packages p LEFT JOIN profiles ON p.author = profiles.steamid WHERE p.rev = (SELECT MAX(p2.rev) FROM packages p2 WHERE p2.id = p.id)"

if category != "" {
q += " AND p.type = ?"
Expand Down Expand Up @@ -140,7 +140,7 @@ func FetchPackageList(category string, author string, search string, offset int,

for rows.Next() {
var pkg common.Package
err := rows.Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.AuthorName, &pkg.AuthorIcon, &pkg.Description, &pkg.Uploaded)
err := rows.Scan(&pkg.ID, &pkg.Revision, &pkg.Type, &pkg.Name, &pkg.Dataname, &pkg.Author, &pkg.AuthorName, &pkg.AuthorIcon, &pkg.Description, &pkg.Downloads, &pkg.Favorites, &pkg.Goods, &pkg.Bads, &pkg.Uploaded)
if err != nil {
return list, err
}
Expand Down

0 comments on commit a82da00

Please sign in to comment.