diff --git a/code/rest/matter_dao.go b/code/rest/matter_dao.go index cbe32f0..8075198 100644 --- a/code/rest/matter_dao.go +++ b/code/rest/matter_dao.go @@ -648,6 +648,11 @@ func (this *MatterDao) SumSizeByUserUuidAndPath(userUuid string, path string) in } +func (this *MatterDao) UpdateSize(matterUuid string, size int64) { + db := core.CONTEXT.GetDB().Model(&Matter{}).Where("uuid = ?", matterUuid).Update("size", size) + this.PanicError(db.Error) +} + func (this *MatterDao) CountByUserUuidAndPath(userUuid string, path string) int64 { var wp = &builder.WherePair{Query: "user_uuid = ? AND path like ?", Args: []interface{}{userUuid, path + "%"}} diff --git a/code/rest/matter_service.go b/code/rest/matter_service.go index 82c146c..20bf68b 100644 --- a/code/rest/matter_service.go +++ b/code/rest/matter_service.go @@ -583,7 +583,9 @@ func (this *MatterService) ComputeRouteSize(matterUuid string, user *User, space //when changed, we update if matter.Size != size { - this.spaceDao.UpdateTotalSize(space.Uuid, size) + this.matterDao.UpdateSize(matterUuid, size) + + matter.Size = size } }