Merge branch 'main' of https://project.nes.uni-due.de/gitea/nes/JackMoodleHelper into main
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# JackMoodleHelper
|
||||
# Jack Tools
|
||||
|
||||
Python script to assist with import and export between JACK and Moodle. Also generates pdf files to print.
|
||||
|
||||
# Usage
|
||||
# Listat - Usage
|
||||
|
||||
Use it as a command line script as follows:
|
||||
```
|
||||
@@ -60,4 +60,20 @@ After the testat:
|
||||
If excel files starting with `RESULTS_PREFIX` are present, the scripts merges the results from JACK with the names from `INPUT` and generates a csv or excel file containing the results. You can edit this file if necessary (e.g. someone uploaded a solution for someone else) and upload it to moodle afterwards.
|
||||
|
||||
## TeX files
|
||||
You need to modify `Serienbrief.tex` and `\input` the correct task. The task definitions are located in `testat1.tex` and similar files. If you want to adjust the tasks, edit the commands `\taskdefinitionA` and `\taskdefinitionB` as well as `\mainclassA` and `\mainclassB`.
|
||||
You need to modify `Serienbrief.tex` and `\input` the correct task. The task definitions are located in `testat1.tex` and similar files. If you want to adjust the tasks, edit the commands `\taskdefinitionA` and `\taskdefinitionB` as well as `\mainclassA` and `\mainclassB`.
|
||||
|
||||
# Restat - Usage
|
||||
Based on this script, you can trigger jack to restart the correction process.
|
||||
|
||||
Please use Python 3.6 :)
|
||||
Use it as a command line script as follows:
|
||||
```
|
||||
usage: restat.py username password name_of_testat name_of_task
|
||||
|
||||
username -> Username from Jack
|
||||
|
||||
password -> Corresponding password
|
||||
|
||||
name_of_testat -> Something like "WS23 - Testat 1 - Gruppe 1&2 (20.11.2023)" (which can be found under "Prüfungen")
|
||||
|
||||
name_of_task -> Something like "Testat 1 - Gruppe A" (which is the corresponding "Aufgabe/Kurs")
|
||||
|
||||
Generated
+3
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
Generated
+1
@@ -0,0 +1 @@
|
||||
restat.py
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="13">
|
||||
<item index="0" class="java.lang.String" itemvalue="scikit-image" />
|
||||
<item index="1" class="java.lang.String" itemvalue="opencv-contrib-python" />
|
||||
<item index="2" class="java.lang.String" itemvalue="pysimplegui" />
|
||||
<item index="3" class="java.lang.String" itemvalue="torch" />
|
||||
<item index="4" class="java.lang.String" itemvalue="numpy" />
|
||||
<item index="5" class="java.lang.String" itemvalue="torchvision" />
|
||||
<item index="6" class="java.lang.String" itemvalue="imgaug" />
|
||||
<item index="7" class="java.lang.String" itemvalue="imageio" />
|
||||
<item index="8" class="java.lang.String" itemvalue="tk" />
|
||||
<item index="9" class="java.lang.String" itemvalue="matplotlib" />
|
||||
<item index="10" class="java.lang.String" itemvalue="imutils" />
|
||||
<item index="11" class="java.lang.String" itemvalue="torchaudio" />
|
||||
<item index="12" class="java.lang.String" itemvalue="Pillow" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="E501" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N802" />
|
||||
<option value="N806" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
Generated
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Restat.iml" filepath="$PROJECT_DIR$/.idea/Restat.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,98 @@
|
||||
import sys
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium import webdriver
|
||||
import time
|
||||
|
||||
from selenium.webdriver.common.by import By
|
||||
import winsound
|
||||
|
||||
|
||||
def log_in(driver, username, password):
|
||||
print("visiting jack website")
|
||||
driver.get("https://jack-server03.s3.uni-due.de/jack2/home.jsf")
|
||||
print("clicking on 'intern'-button")
|
||||
intern_button = driver.find_element_by_xpath('//a[text()="Intern"]')
|
||||
driver.implicitly_wait(1)
|
||||
intern_button.click()
|
||||
driver.implicitly_wait(1)
|
||||
print("logging in with given credentials")
|
||||
username_text_box = driver.find_element(By.NAME, "login_form:loginName")
|
||||
username_text_box.send_keys(username)
|
||||
driver.implicitly_wait(1)
|
||||
username_text_box = driver.find_element(By.NAME, "login_form:password")
|
||||
username_text_box.send_keys(password)
|
||||
driver.implicitly_wait(1)
|
||||
login_button = driver.find_element(By.NAME, "login_form:loginbutton")
|
||||
login_button.click()
|
||||
driver.implicitly_wait(1)
|
||||
|
||||
|
||||
def get_zeige_ergebnisdetails_list(driver, testat_category):
|
||||
print("selecting selected testat category")
|
||||
intern_button = driver.find_element_by_xpath('//a[text()="' + testat_category + '"]')
|
||||
intern_button.click()
|
||||
driver.implicitly_wait(1)
|
||||
print("Providing list of 'Zeige Ergebnisdetails'")
|
||||
return driver.find_elements_by_xpath('//a[text()="Zeige Ergebnisdetails"]')
|
||||
|
||||
|
||||
def restart_tasks(driver, zeige_ergebnisdetails_list, task_name):
|
||||
print("Restarting elements")
|
||||
zeige_ergebnis_details_list_len = len(zeige_ergebnisdetails_list)
|
||||
zeige_ergebnis_details_idx = 0
|
||||
while zeige_ergebnis_details_idx < zeige_ergebnis_details_list_len:
|
||||
zeige_ergebnisdetails_list = driver.find_elements_by_xpath('//a[text()="Zeige Ergebnisdetails"]')
|
||||
zeige_ergebnisdetails_list[zeige_ergebnis_details_idx].click()
|
||||
driver.implicitly_wait(5)
|
||||
tasks = driver.find_elements_by_xpath('//a[text()="' + task_name + '"]')
|
||||
task_list_len = len(tasks)
|
||||
if task_list_len != 0:
|
||||
task_idx = 0
|
||||
while task_idx < task_list_len:
|
||||
tasks = driver.find_elements_by_xpath('//a[text()="' + task_name + '"]')
|
||||
current_task = tasks[task_idx]
|
||||
current_task.click()
|
||||
driver.implicitly_wait(5)
|
||||
input_elements = driver.find_elements_by_xpath('//input')
|
||||
restart_button = [element for element in input_elements if "deleteResultsButton" in element.get_attribute("name")][0]
|
||||
# restart_button = driver.find_element(By.NAME, "j_id13:deleteResultsButton") #Restart of task
|
||||
# restart_button = driver.find_element(By.XPATH, '//button[text()="Outliers"]')
|
||||
restart_button.click()
|
||||
driver.implicitly_wait(5)
|
||||
while "ExamEdit" not in driver.current_url:
|
||||
driver.back()
|
||||
driver.implicitly_wait(5)
|
||||
task_idx += 1
|
||||
if "Overview" not in driver.current_url:
|
||||
zurueck_zur_pruefung_button = driver.find_element_by_xpath('//a[text()="Zurück zur Prüfung"]')
|
||||
zurueck_zur_pruefung_button.click()
|
||||
driver.implicitly_wait(5)
|
||||
zeige_ergebnis_details_idx += 1
|
||||
driver.implicitly_wait(5)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
username = sys.argv[1]
|
||||
password = sys.argv[2]
|
||||
testat_category = sys.argv[3]
|
||||
task_name = sys.argv[4]
|
||||
print("loading webdriver")
|
||||
driver = webdriver.Firefox(executable_path="geckodriver-v0.33.0-win64/geckodriver.exe")
|
||||
print("initiating login")
|
||||
log_in(driver, username, password)
|
||||
list = get_zeige_ergebnisdetails_list(driver, testat_category)
|
||||
restart_tasks(driver, list, task_name)
|
||||
driver.quit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
duration = 1000 # milliseconds
|
||||
freq = 440 # Hz
|
||||
winsound.Beep(freq, duration)
|
||||
print("Starting Restat")
|
||||
main()
|
||||
duration = 1000 # milliseconds
|
||||
freq = 440 # Hz
|
||||
winsound.Beep(freq, duration)
|
||||
print("Ending Restat")
|
||||
@@ -1,4 +0,0 @@
|
||||
pandas
|
||||
xlrd
|
||||
openpyxl
|
||||
matplotlib
|
||||
Reference in New Issue
Block a user