fix tweet deserializing

This commit is contained in:
muskit
2023-08-20 16:05:32 -07:00
parent 7102fb3cc5
commit 492d96e68b
+7 -1
View File
@@ -55,7 +55,7 @@ class TalentTweet:
mode = '' mode = ''
for i in range(3, len(tokens)): for i in range(3, len(tokens)):
if len(tokens[i]) == 1 and not tokens[i].isnumeric(): # mode switch if not tokens[i].isnumeric(): # mode switch
mode = tokens[i] mode = tokens[i]
continue continue
@@ -72,6 +72,8 @@ class TalentTweet:
rt = int(tokens[i]) rt = int(tokens[i])
if mode == 'rtm': # retweet/qrt mentions if mode == 'rtm': # retweet/qrt mentions
rtm.append(int(tokens[i])) rtm.append(int(tokens[i]))
else:
raise ValueError(f'encountered invalid mode token {mode}')
return TalentTweet( return TalentTweet(
tweet_id=tweet_id, author_id=author_id, tweet_id=tweet_id, author_id=author_id,
@@ -161,9 +163,13 @@ class TalentTweet:
return util.get_tweet_url(self.tweet_id, self.username) return util.get_tweet_url(self.tweet_id, self.username)
def is_cross_company(self): def is_cross_company(self):
if self.author_id == self.rt_author_id:
return False
for other_id in self.all_parties: for other_id in self.all_parties:
if tl.is_cross_company(self.author_id, other_id): if tl.is_cross_company(self.author_id, other_id):
return True return True
return False return False
def get_all_parties_usernames(self): def get_all_parties_usernames(self):