Skip to content

Commit c345180

Browse files
peterdragun1ukastesar
authored andcommitted
fix(absolvent): update xpath for thesis author
1 parent 046dccd commit c345180

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cogs/absolvent/cog.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import asyncio
6+
import logging
67
import re
78
import unicodedata
89

@@ -22,6 +23,7 @@
2223
class Absolvent(Base, commands.Cog):
2324
def __init__(self, bot: Rubbergod):
2425
super().__init__()
26+
self.logger = logging.getLogger("rubbergod")
2527
self.bot = bot
2628

2729
@commands.slash_command(name="diplom_help", description=MessagesCZ.diplom_help_brief)
@@ -119,7 +121,7 @@ def remove_accents(input_str):
119121
master_thesis = "".join(xDoc_thesis.xpath(breadcrumb_xpath.format(3, "diplomové práce")))
120122
bachelor_thesis = "".join(xDoc_thesis.xpath(breadcrumb_xpath.format(3, "bakalářské práce")))
121123
thesis_author_without_degree_surname_first = "".join(
122-
xDoc_thesis.xpath('//div[./h5/.="Authors"]//div/a/text()')
124+
xDoc_thesis.xpath('//div[./h5/.="Authors"]//div//text()')
123125
).strip()
124126
habilitation_date = "".join(xDoc_thesis.xpath('//div[./h5/.="Date of acceptance"]//div/span/text()'))
125127
result = "".join(xDoc_thesis.xpath('//div[./h5/.="Result of defence"]//div/span/text()'))
@@ -143,6 +145,14 @@ def remove_accents(input_str):
143145
and thesis_author_without_degree_surname_first == full_name_without_degree_surname_first
144146
):
145147
await inter.edit_original_response(MessagesCZ.web_error)
148+
self.logger.info(f"[Absolvent] Thesis verification failed for thesis: {thesis_url}")
149+
self.logger.info("[Absolvent] Data parsed from the website:")
150+
self.logger.info(f"Degree: {degree}")
151+
self.logger.info(f"Thesis: {master_thesis} {bachelor_thesis}")
152+
self.logger.info(f"diploma_year: {diploma_year}")
153+
self.logger.info(f"habilitation_year: {habilitation_year}")
154+
self.logger.info(f"faculty: {faculty}")
155+
self.logger.info(f"result: {result}")
146156
return
147157

148158
# DIPLOMA VALIDITY CHECK

0 commit comments

Comments
 (0)