Skip to content

Commit

Permalink
Merge pull request jxxghp#3559 from InfinityPacer/feature/site
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp authored Dec 18, 2024
2 parents 1dd7dc3 + fca763b commit 3169158
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/db/models/siteuserdata.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime

from sqlalchemy import Column, Integer, String, Sequence, Float, JSON, func
from sqlalchemy import Column, Integer, String, Sequence, Float, JSON, func, or_
from sqlalchemy.orm import Session

from app.db import db_query, Base
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_latest(db: Session):
func.max(SiteUserData.updated_day).label('latest_update_day')
)
.group_by(SiteUserData.domain)
.filter(SiteUserData.err_msg.is_(None))
.filter(or_(SiteUserData.err_msg.is_(None), SiteUserData.err_msg == ""))
.subquery()
)

Expand Down
3 changes: 2 additions & 1 deletion app/db/site_oper.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def update_userdata(self, domain: str, name: str, payload: dict) -> Tuple[bool,
"domain": domain,
"name": name,
"updated_day": current_day,
"updated_time": current_time
"updated_time": current_time,
"err_msg": payload.get("err_msg") or ""
})
# 按站点+天判断是否存在数据
siteuserdatas = SiteUserData.get_by_domain(self._db, domain=domain, workdate=current_day)
Expand Down

0 comments on commit 3169158

Please sign in to comment.