JPlag
JPlag copied to clipboard
Enable Multiroot for Report Viewer
This is still WIP but I wanted to share my approach already to receive feedback
This PR intends to fix two major issues (both noted in issue #354):
- Submission names were concatenated to produce the comparison file name. When JPlag is run with multiple roots, the submission names contain backward slashes causing file creation to crash.
- As Submission names were concatenated duplicate names could easily be produced in the single source case ({
A, A-B, C, B-C}
would result in twoA-B-C
)
My approach to fixing this:
- Differentiation between the submission name, submission id, and submission display name.
-
Submission name
simply refers to Submission#name -
Submission id
is newly introduced and used only in the context of the report viewer creation. Generation of this id is the topic of another (our next 😄 ) discussion, but currently, it is the sanitized version of the submission name (File separator replaced by underscore). This submission id serves as an id for internal handling in the report viewer. -
Display name
is the name of a submission to be displayed by the report viewer. Theoverview.json
file contains a map <submission id
->display name
> the report viewer will use to resolve the name for presentation purposes.
-
- Two be able to abolish name concatenation of submission names for the comparison file name, I introduced a nested lookup table to the
overview.json
. It has the structure <submission id
-> <<submission id
> -><comparison file name
>>>. With this data structure, there will be no duplicate comparison file names and additionally, the comparison file name can be chosen arbitrarily as the frontend will only have to execute two gets two receive the file name and will not have to rely on string concatenation.
Currently, the nested lookup table contains all submission ids in its first level, and in the second level, it contains each comparison for the corresponding submission id. This redundancy could be eliminated and actually halve the table's size but this is an optimization for later. The UI isn't fully compatible with this approach yet, but will be with my next commits.
EDIT: The report viewer is now fully compatible with the updated file format. I realised that the problem in 2. persisted, as I still used id concatenation. Therefore, I changed the comparison file name generation to simply be a number that is counted up for each file. While this worsens human readability, it solves the aforementioned issue. As always, suggestions on how to solve this issue while maintaining readability are welcome.
@tsaglam this is good to go
Sorry, I'm late to the party, but I noticed that the ComparisonReportWriterTest
writes test report files to ${baseDir}\jPlag
and does not remove them afterwards. I suggest that they are created in a special output directory and/or removed after the test.
Should be already fixed by #607