This commit is contained in:
parent
a5fc856764
commit
15a960da19
2 changed files with 5 additions and 1 deletions
|
@ -91,6 +91,10 @@ func handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func splitInt(n int) []int {
|
func splitInt(n int) []int {
|
||||||
|
if n == 0 {
|
||||||
|
return []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
slc := []int{}
|
slc := []int{}
|
||||||
for n > 0 {
|
for n > 0 {
|
||||||
slc = append(slc, n%10)
|
slc = append(slc, n%10)
|
||||||
|
|
|
@ -341,7 +341,7 @@ func handleStats(w http.ResponseWriter, r *http.Request) {
|
||||||
var saved int
|
var saved int
|
||||||
err = db.QueryRow(r.Context(),
|
err = db.QueryRow(r.Context(),
|
||||||
`SELECT (SUM(old_size) - COALESCE(SUM(size), 0)) AS saved
|
`SELECT (SUM(old_size) - COALESCE(SUM(size), 0)) AS saved
|
||||||
FROM files WHERE ($1 = -1 OR files.library_id = $1) AND status = $2 AND old_size NOT NULL`, id, constants.FILE_STATUS_EXISTS).Scan(&saved)
|
FROM files WHERE ($1 = -1 OR files.library_id = $1) AND status = $2 AND old_size IS NOT NULL`, id, constants.FILE_STATUS_EXISTS).Scan(&saved)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
saved = 0
|
saved = 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue