Add the avility to edit metadata and delete books after submission
This commit is contained in:
parent
de58f0251e
commit
8d126fbe7a
7 changed files with 93 additions and 48 deletions
24
lib/stats.go
24
lib/stats.go
|
@ -50,6 +50,30 @@ func (h handler) load(tmpl string, data interface{}) {
|
|||
}
|
||||
}
|
||||
|
||||
func (h handler) booksInSubmission(bookIDs []string, submissionID string) bool {
|
||||
submissions, err := h.db.GetSubmission(submissionID)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
for _, bookID := range bookIDs {
|
||||
if bookID == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
found := false
|
||||
for _, s := range submissions {
|
||||
if s.BookID == bookID && !s.Book.Active {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type StatsGatherer struct {
|
||||
db database.DB
|
||||
store storage.Store
|
||||
|
|
Reference in a new issue