Fix service usage of new stats

master
Caj Larsson 3 years ago
parent d688900bae
commit c8d5410936

@ -38,7 +38,9 @@ func (s SwampFileService) getOrCreateNs(namespace_in string) *namespace.Namespac
time.Now(),
s.default_allowance_duration,
namespace.FileSizeQuota{s.default_allowance_bytes, 0},
namespace.Usage{0, 0, 0, 0, 0},
namespace.FileStat{0, 0},
namespace.FileStat{0, 0},
namespace.FileStat{0, 0},
}
created_ns, err := s.namespace_repo.Create(new_ns)
@ -93,7 +95,8 @@ func (s SwampFileService) SaveFile(ref swampfile.FileReference, src io.Reader, s
f.Close()
ns.FileQuota.Add(size)
ns.Usage = ns.Usage.Downloaded(size)
ns.Usage = ns.Usage.Add(size)
ns.Upload = ns.Upload.Add(size)
s.namespace_repo.Update(ns.ID, *ns)
return nil

Loading…
Cancel
Save