Skip to content

Commit

Permalink
close #52 issue is handled by strip of the messages
Browse files Browse the repository at this point in the history
this commit is not the changed that solved the problem - only cleaning the code
  • Loading branch information
InbarShirizly committed Nov 16, 2020
1 parent e5fd247 commit 03d5685
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions server/src/api/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def chat_file(self, value):
"""
if not Validators.check_ext(value.filename, self._supported_chat_file_ext):
raise ValueError(RestErrors.INVALID_CHAT_FILE)
a = value.stream.read().decode("utf-8")
chat_file = a.split("\n") #TODO: check this in test -maybe split here is not relevant
chat_df = create_chat_df(chat_file)
chat_df = create_chat_df(value.stream.read().decode("utf-8"))
if chat_df.empty:
raise ValueError(RestErrors.INVALID_CHAT_FILE)
return chat_df
Expand Down
2 changes: 1 addition & 1 deletion server/src/parsing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create_chat_df(chat_file):
chat_content = [re.search(regex_pattern, line).groups() for line in chat_file if re.match(regex_pattern, line)]

chat_df = pd.DataFrame(chat_content, columns=["time", "zoom_name", "message"])
chat_df['message'] = chat_df['message'].astype(str) # remove end of line (could be "/n" or "/t") #TODO: check on windows if the problem appears now
chat_df['message'] = chat_df['message'].astype(str)
chat_df["time"] = chat_df["time"].apply(lambda string: datetime.strptime(string, "%H:%M:%S"))
return chat_df

Expand Down

0 comments on commit 03d5685

Please sign in to comment.