oppia/oppia

UserContributionRightsModel.put() should not be called from the service layer

开放

#18,728 创建于 2023年8月2日

 (45 条评论) (0 个反应) (1 位负责人)Python (3,534 个派生)batch import
Impact: HighWork: Lowgood first issue

仓库指标

星标
 (5,292 个星标)
PR 合并指标
 (平均合并 20天 19小时) (30 天内合并 71 个 PR)

描述

We are calling UserContributionRightsModel.put() from the user_service.py as per the below link.

https://github.com/oppia/oppia/blob/4def547d5425ff55f772ec2907885a7961ee330a/core/domain/user_services.py#L647

This would create some inconsistent records in the UserContributionRightsModel as some fields (created_on, last_updated) are missed while creating models.

In general we should not be calling GAE datastore methods like put() directly from the service layer. All direct datastore put(), get() calls should be done from the storage layer and make use of methods on the base storage layer classes (see other storage model classes for examples).

What is expected from this issue:

Check how we do the same thing here: https://github.com/oppia/oppia/blob/develop/core/domain/suggestion_services.py#L771-L777

贡献者指南