leadguru-jobs 0.432.0__py3-none-any.whl → 0.434.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: leadguru_jobs
3
- Version: 0.432.0
3
+ Version: 0.434.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -9,7 +9,7 @@ lgt_jobs/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  lgt_jobs/jobs/analytics.py,sha256=iN1Z9ZtRHrpjzmSN4cbqwL6XzGWQYFmDBnBG-NvmlMc,974
10
10
  lgt_jobs/jobs/archive_leads.py,sha256=Rc9MTWvVUCMEXi7mTrHWKZVyaRiseCFpHqUZcXekmIk,849
11
11
  lgt_jobs/jobs/bot_stats_update.py,sha256=gEOmVLcervGMMJUmo9otQtUltwLNBXheX8zDwoABbik,7350
12
- lgt_jobs/jobs/chat_history.py,sha256=_8ZcpO2s8EFxuL7n_R3shnNsjHz815d1DxB9x7PPAaY,5338
12
+ lgt_jobs/jobs/chat_history.py,sha256=kAtXtz9ql7RHr_jWjCtxnTl415n10gQvumWmfl5hd-c,5355
13
13
  lgt_jobs/jobs/inbox_leads.py,sha256=HGnhZEzMZw_Yzf40tQIRQc3E3QmcmEUyc1c5KTmJHFI,4646
14
14
  lgt_jobs/jobs/mass_message.py,sha256=jLO-yykQzf-V7JY7a6PFwVoT4z91SJWN5UPrHj_xAP8,2039
15
15
  lgt_jobs/jobs/send_code.py,sha256=ei5WHVpI2w2gv0JGU8wjg0HJYUO_OZqNJPm-W6yO1dA,828
@@ -39,11 +39,11 @@ lgt_jobs/lgt_data/engine.py,sha256=iTcLvU7QZvB14hcERQrxSql9cVEcMEzu_tUcWD2Z24A,8
39
39
  lgt_jobs/lgt_data/enums.py,sha256=A5nWwBgTVW7XaqL30NHNmO0SG_yeDk1dI-U5xrgU2zg,1552
40
40
  lgt_jobs/lgt_data/helpers.py,sha256=58ycqKF1z5nAw0vs6yVCg-SQet107YHyKYXaQUc7M68,157
41
41
  lgt_jobs/lgt_data/model.py,sha256=4J3WpmnIJ6pNWnSnZFQUnnyeZutDRGP2B3j0JzHdXww,28044
42
- lgt_jobs/lgt_data/mongo_repository.py,sha256=84QkEhXiTzGTD4dv4osTfP5OGJaDCyUHicUSm_kDn2o,39869
42
+ lgt_jobs/lgt_data/mongo_repository.py,sha256=x8uYx2-3tR4PO_sbQm9YrenNXvHvW3qNdGbVndr_ggo,39932
43
43
  lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  lgt_jobs/services/web_client.py,sha256=NdVK1Xl8IDqUDZKqYNq219WOO7DtLj3b4VFjP69_MQY,2047
45
45
  lgt_jobs/templates/new_message_mail_template.html,sha256=82XdDPtmkJVUWUcZtgd8bv_9-viAG2WWOnf3AhR6PeY,3635
46
- leadguru_jobs-0.432.0.dist-info/METADATA,sha256=jRU5CtQ2NfsuS71ODBAFZL90mw9P3dugNqSXd5NnUFc,1296
47
- leadguru_jobs-0.432.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
- leadguru_jobs-0.432.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
49
- leadguru_jobs-0.432.0.dist-info/RECORD,,
46
+ leadguru_jobs-0.434.0.dist-info/METADATA,sha256=dE63rQbTWw03vkhYUiTotIf5LoN-qyBS363uEAXBmBw,1296
47
+ leadguru_jobs-0.434.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
48
+ leadguru_jobs-0.434.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
49
+ leadguru_jobs-0.434.0.dist-info/RECORD,,
@@ -97,7 +97,7 @@ class LoadChatHistoryJob(BaseBackgroundJob, ABC):
97
97
  new_messages = LoadChatHistoryJob._get_new_messages(contact, bot, messages)
98
98
  chat_history = [message.to_dic() for message in new_messages]
99
99
  ChatRepository().upsert_messages(chat_history)
100
- return new_messages[-1] if bot.associated_user != contact.sender_id else None
100
+ return new_messages[-1] if bot.associated_user != contact.sender_id and new_messages else None
101
101
 
102
102
  @staticmethod
103
103
  def _notify_about_new_messages(user: UserModel, contact: UserContact, template_path: str):
@@ -1081,7 +1081,8 @@ class ChatRepository(BaseMongoRepository):
1081
1081
 
1082
1082
  def upsert_messages(self, messages: list[dict]):
1083
1083
  if messages:
1084
- operations = [UpdateOne({"id": msg['id']}, {'$set': msg}, upsert=True) for msg in messages]
1084
+ operations = [UpdateOne({"id": msg['id'], "user_id": msg['user_id']},
1085
+ {'$set': msg}, upsert=True) for msg in messages]
1085
1086
  self.collection().bulk_write(operations)
1086
1087
 
1087
1088
  def delete_message(self, user_id: str, _id: str):