Commit 17b9612f authored by Las Zenow's avatar Las Zenow

Let's try to gather stats only if the book exist

* Closes: #42
parent 5bcb08ef
......@@ -137,7 +137,6 @@ func (sg StatsGatherer) worker() {
}
func (sg StatsGatherer) save(req statsRequest) {
var err error
id := mux.Vars(req.r)["id"]
search := strings.Join(req.r.Form["q"], " ")
fmt := req.r.FormValue("fmt")
......@@ -155,6 +154,11 @@ func (sg StatsGatherer) save(req statsRequest) {
Fmt: fmt,
Duration: req.duration,
})
_, err := sg.db.GetBookID(id)
if err != nil {
return
}
switch section {
case "download":
err = sg.db.IncDownloads(id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment