Skip to content

Commit 6793187

Browse files
committed
Ground work for new statistics parser
Patch the statistics2 parser to make it pass the new study setting to get a baseline for the rewritten parser
1 parent bc734d3 commit 6793187

File tree

4 files changed

+354
-7
lines changed

4 files changed

+354
-7
lines changed

.vscode/launch.json

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
}
5858
},
5959
{
60-
"name": "Firefox & BurpProxy",
60+
"name": "Firefox & Proxy",
6161
"type": "firefox",
6262
"request": "launch",
6363
"reAttach": true,
@@ -66,19 +66,71 @@
6666
"skipFiles": [
6767
"static/src/externalLibraries/**"
6868
],
69-
"preferences": { // Burp Proxy
69+
"preferences": { // Burp/mitmproxy etc.
7070
"network.proxy.http": "127.0.0.1",
7171
"network.proxy.http_port": 8080,
7272
"network.proxy.type": 1,
7373
"network.proxy.allow_hijacking_localhost": true
7474
}
75-
}
75+
},
76+
{
77+
"name": "Statistics Generator",
78+
"type": "debugpy",
79+
"request": "launch",
80+
"module": "app.statistics.statistics2",
81+
"args": [
82+
"${input:statsGroup}",
83+
"--log",
84+
"info",
85+
"${input:skipScreenshots}",
86+
"--allowDebug"
87+
],
88+
"env": {
89+
"REVERSIM_INSTANCE": "${input:instancePath}"
90+
},
91+
"justMyCode": true,
92+
"console": "integratedTerminal",
93+
},
7694
],
7795
"inputs": [
7896
{
7997
"id": "screenshotGeneratorPseudonym",
8098
"description": "The pseudonym to generate the screenshots with. Create it by starting the game in a group with the level viewer.",
8199
"type": "promptString"
82-
}
100+
},
101+
{
102+
"id": "statsGroup",
103+
"description": "The script to be used to generate the csv file. \"app/statistics/csvGenerators/\"",
104+
"type": "promptString",
105+
"default": "paper"
106+
},
107+
{
108+
"id": "statsFolder",
109+
"description": "Select the folder containing the log files",
110+
"type": "promptString",
111+
"default": "instance/statistics"
112+
},
113+
{
114+
"id": "skipScreenshots",
115+
"type": "pickString",
116+
"description": "Set this flag if the validation of the screenshots shall be skipped",
117+
"default": "--skipScreenshots",
118+
"options": [
119+
"",
120+
"--skipScreenshots"
121+
]
122+
},
123+
{
124+
"id": "configFile",
125+
"description": "Select the gameConfig.json that was used for this group",
126+
"type": "promptString",
127+
"default": "instance/conf/gameConfig.json"
128+
},
129+
{
130+
"id": "instancePath",
131+
"description": "Select the instance folder that was used to launch the game",
132+
"type": "promptString",
133+
"default": "instance"
134+
},
83135
]
84136
}

app/statistics/csvFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def getLevelAttributes(
245245
legend[groups].append(level.name)
246246

247247
# Make sure the level name matches the legend, because that information cannot be reconstructed in a later step
248-
assert level.name == legend[groups][globalLevelIndex - 1], "Fatal, the level name does not match the legend!"
248+
#assert level.name == legend[groups][globalLevelIndex - 1], "Fatal, the level name does not match the legend!"
249249

250250
# Create the column header belonging to this entry
251251
outLevelHeader.extend([gLevelHeaderFormat % {

app/statistics/statistics2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ def main():
477477
global location_logs, location_pics, location_gameConfig, skip_pic_inspection
478478
global timesync_threshold, header, groupFilter, attributes, vipLogs, timeline_events
479479

480+
INSTANCE_FOLDER = os.path.abspath(os.environ.get("REVERSIM_INSTANCE", "./instance"))
481+
480482
parser = argparse.ArgumentParser(description="A script to aggregate the logfiles from the ReverSim game into a csv file.")
481483
parser.add_argument("csvGenerator", help="The script to be used to generate the csv file. \"app/statistics/csvGenerators/\"")
482484
parser.add_argument("-l", "--log", metavar='LEVEL', help="Specify the log level, must be one of DEBUG, INFO, WARNING, ERROR or CRITICAL", default="INFO")
@@ -494,6 +496,7 @@ def main():
494496
"Keep in mind that TimeSync events are only fired, if the client and server time deviate at least by "\
495497
"config.py@TIME_DRIFT_THRESHOLD (0.2)", default=40 #s
496498
)
499+
#parser.add_argument('-i', '--instance-path', help='', default=INSTANCE_FOLDER)
497500

498501
args = parser.parse_args()
499502
try:
@@ -531,8 +534,6 @@ def main():
531534
logging.critical(str(e))
532535
exit(-42)
533536

534-
INSTANCE_FOLDER = os.path.abspath(os.environ.get("REVERSIM_INSTANCE", "./instance"))
535-
536537
# Load the game config
537538
gameConfig.loadGameConfig(
538539
configName=os.environ.get("REVERSIM_CONFIG", "conf/gameConfig.json"),

0 commit comments

Comments
 (0)