配送时段设置 bug
This commit is contained in:
parent
436d09a5f5
commit
be946cc639
@ -249,19 +249,16 @@ async def get_group_by_community(
|
|||||||
):
|
):
|
||||||
"""根据社区进行 group 的配送时段列表"""
|
"""根据社区进行 group 的配送时段列表"""
|
||||||
try:
|
try:
|
||||||
#1. 查询有配送时段数据的社区
|
|
||||||
community_time_periods = db.query(CommunityTimePeriodDB).all()
|
|
||||||
communities = db.query(CommunityDB).offset(skip).limit(limit).all()
|
communities = db.query(CommunityDB).offset(skip).limit(limit).all()
|
||||||
|
|
||||||
#2. 查询社区的配送时段
|
|
||||||
community_time_periods = db.query(CommunityTimePeriodDB, TimePeriodDB.name.label("time_period_name"),TimePeriodDB.from_time.label("time_period_from_time"), TimePeriodDB.to_time.label("time_period_to_time")).join(TimePeriodDB).filter(
|
|
||||||
CommunityTimePeriodDB.community_id.in_([community.id for community in communities])
|
|
||||||
).all()
|
|
||||||
|
|
||||||
#3. 根据社区进行 group 的配送时段列表
|
#3. 根据社区进行 group 的配送时段列表
|
||||||
communities_with_time_periods = []
|
communities_with_time_periods = []
|
||||||
for community in communities:
|
for community in communities:
|
||||||
community_time_periods = [ctp for ctp in community_time_periods if ctp.CommunityTimePeriodDB.community_id == community.id]
|
# 查询配送时段
|
||||||
|
community_time_periods = db.query(CommunityTimePeriodDB, TimePeriodDB.name.label("time_period_name"),TimePeriodDB.from_time.label("time_period_from_time"), TimePeriodDB.to_time.label("time_period_to_time")).join(TimePeriodDB).filter(
|
||||||
|
CommunityTimePeriodDB.community_id == community.id
|
||||||
|
).all()
|
||||||
|
|
||||||
communities_with_time_periods.append({
|
communities_with_time_periods.append({
|
||||||
"community_id": community.id,
|
"community_id": community.id,
|
||||||
"community_name": community.name,
|
"community_name": community.name,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user