Commit a11d9b8f authored by Mathis Chenuet's avatar Mathis Chenuet

some fixes

parent cbaef3cd
Pipeline #43203 failed with stage
in 44 seconds
......@@ -10,4 +10,4 @@ Pipfile.lock
__pycache__
.keys
main.pdf
.mypy_cache
\ No newline at end of file
.mypy_cache
......@@ -5,14 +5,14 @@ from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from src.latexer import LaTeXer
from src.settings import PROJECT_FOLDER
from src.settings import LANG, PROJECT_FOLDER
from src.utils import get_db_string, get_student_details
if __name__ == "__main__":
# Specifying info
final_doc = os.path.join(PROJECT_FOLDER, "main.pdf")
latexer = LaTeXer(final_doc=final_doc)
latexer = LaTeXer(lang=LANG, final_doc=final_doc)
# Getting interface for data
engine = create_engine(get_db_string())
......@@ -22,7 +22,10 @@ if __name__ == "__main__":
student_details = get_student_details()
# Cooking the transcript 👨‍🍳
latexer.generate_transcript(student_details, session,
remove_temp_dir=False,
add_sem_comment=False,
break_page_on_semester=True)
latexer.generate_transcript(
student_details,
session,
remove_temp_dir=False,
add_sem_comment=False,
break_page_on_semester=True,
)
#!/usr/bin/env python3
import os
from pathlib import Path
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
......@@ -13,6 +14,7 @@ if __name__ == "__main__":
scrapper = UTCScrapper(results_file=os.path.join(DATA_FOLDER, 'results.html'))
# Cleaning things
Path(__file__).with_name('data').mkdir(exist_ok=True)
reset_db()
db_string = get_db_string()
......
......@@ -112,3 +112,6 @@ class DriverWrapper:
def find_elements_by_xpath(self, name):
return self._d.find_elements_by_xpath(name)
def __getattr__(self, name):
return getattr(self._d, name)
......@@ -322,9 +322,9 @@ class UTCScrapper:
# Switching language
if lang == "fr":
driver.find_element_by_xpath('//*[@id="mainForm:j_idt206"]/img').click()
driver.find_element_by_css_selector('[src="img/france.png"]').click()
else:
driver.find_element_by_xpath('//*[@id="mainForm:j_idt212"]/img').click()
driver.find_element_by_css_selector('[src="img/uk.png"]').click()
time.sleep(2)
diploma_option = "Ingénieur UTC - Branche" if lang == "fr" \
......@@ -498,7 +498,7 @@ class UTCScrapper:
courses_indices = dict()
def xpath_of_course_code(number):
return f'//*[@id="mainForm"]/div/table/tbody/tr[{number+1}]/td[1]'
return f'//*[@id="mainForm"]/div/table/tbody/tr[{number+2}]/td[1]'
while course_to_parse:
elems = driver.find_elements_by_xpath(xpath_of_course_code(index))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment