mirror of
https://github.com/documize/community.git
synced 2025-07-24 07:39:43 +02:00
Overhaul the space stats module
Closes #274 All space counters are reset after document and catergory operations.
This commit is contained in:
parent
6b723568d3
commit
fad1de2e41
7 changed files with 1095 additions and 1142 deletions
|
@ -247,17 +247,10 @@ func (h *Handler) SaveAs(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
err = h.Store.Space.IncrementContentCount(ctx, doc.SpaceID)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
response.WriteServerError(w, method, err)
|
||||
h.Runtime.Log.Error(method, err)
|
||||
return
|
||||
}
|
||||
|
||||
// Commit and return new document template
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Space.SetStats(ctx, doc.SpaceID)
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeTemplateAdd)
|
||||
|
||||
doc, err = h.Store.Document.Get(ctx, docID)
|
||||
|
@ -434,16 +427,9 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
err = h.Store.Space.IncrementContentCount(ctx, d.SpaceID)
|
||||
if err != nil {
|
||||
ctx.Transaction.Rollback()
|
||||
response.WriteServerError(w, method, err)
|
||||
h.Runtime.Log.Error(method, err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Store.Space.SetStats(ctx, d.SpaceID)
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeTemplateUse)
|
||||
|
||||
nd, err := h.Store.Document.Get(ctx, documentID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue