Skip to content

Commit fcca36d

Browse files
committed
Updated. job_compassplus/mysite_compassplus_com/get_profile_info_from_web/
1 parent 95d1674 commit fcca36d

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

job_compassplus/mysite_compassplus_com/get_profile_info_from_web/db.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,13 @@ def get_all_name(cls) -> list[str]:
151151

152152
if __name__ == "__main__":
153153
BaseModel.print_count_of_tables()
154+
print()
155+
156+
names: list[str] = Person.get_all_name()
157+
persons: list[Person] = [
158+
Person.get_last_by_name(name)
159+
for name in names
160+
]
161+
print(f"Total: {len(persons)}")
162+
print(f"Active: {len([p for p in persons if p.is_active])}")
163+
print(f"Non active: {len([p for p in persons if not p.is_active])}")

job_compassplus/mysite_compassplus_com/get_profile_info_from_web/db_updater.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def add_or_get_db(name: str, forced: bool = False) -> db.Person | None:
8383
# Создание новой записи с актуальными полями
8484
person = create_person_from_info(info)
8585

86-
else: # Если пользователь был в БД, а потом его удалили из mysite
86+
elif person.is_active: # Если пользователь был в БД и активным, а потом его удалили из mysite
8787
# Создание новой записи
8888
return db.Person.create(
8989
name=person.name,
@@ -134,6 +134,8 @@ def do_update_db(forced: bool = False):
134134

135135

136136
if __name__ == "__main__":
137-
print(add_or_get_db("ipetrash"))
137+
user_name = "akrylov"
138+
print(get_person_info(user_name))
139+
print(add_or_get_db(user_name, forced=True))
138140

139141
# do_update_db(forced=True)

0 commit comments

Comments
 (0)