Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Multiroot for Report Viewer #569

Merged
merged 16 commits into from
Aug 22, 2022

Conversation

nestabentum
Copy link
Contributor

@nestabentum nestabentum commented Aug 5, 2022

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):

  1. 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.
  2. 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 two A-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. The overview.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.

@nestabentum nestabentum force-pushed the reportViewer_multiRoot branch from c5ce482 to 3416e17 Compare August 6, 2022 09:10
@tsaglam tsaglam added enhancement Issue/PR that involves features, improvements and other changes major Major issue/feature/contribution/change report-viewer PR / Issue deals (partly) with the report viewer and thus involves web-dev technologies labels Aug 6, 2022
@tsaglam tsaglam added this to the v4.0.0 milestone Aug 6, 2022
@tsaglam tsaglam requested review from sebinside and a team August 6, 2022 10:19
@nestabentum nestabentum force-pushed the reportViewer_multiRoot branch 2 times, most recently from bb3b4bb to 2326c46 Compare August 9, 2022 18:27
@nestabentum nestabentum marked this pull request as ready for review August 9, 2022 18:27
Copy link
Member

@dfuchss dfuchss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments :)

@nestabentum nestabentum force-pushed the reportViewer_multiRoot branch from a8daeaa to 33ad244 Compare August 11, 2022 17:31
@nestabentum nestabentum force-pushed the reportViewer_multiRoot branch from 33ad244 to 5637c3d Compare August 12, 2022 06:24
Copy link
Member

@sebinside sebinside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only had a quick look over the code, so there is a more in-depth review from @jplag/studdev required. But it tested the PR with two directories with 200 and 50 submissions, and everything worked fine.

Probably not related to this PR, but sometimes, the comparison viewer still breaks, but not predictable with the warning Could not find comparison file. indes.js:43 and then with the error:

templateLoader.js?e847:50 
        
       Uncaught (in promise) TypeError: _ctx.isAnonymous is not a function
    at Proxy.render (templateLoader.js?e847:50:1)
    at renderComponentRoot (runtime-core.esm-bundler.js?d2dd:896:1)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?d2dd:5580:1)
    at ReactiveEffect.run (reactivity.esm-bundler.js?89dc:185:1)
    at instance.update (runtime-core.esm-bundler.js?d2dd:5694:1)
    at setupRenderEffect (runtime-core.esm-bundler.js?d2dd:5708:1)
    at mountComponent (runtime-core.esm-bundler.js?d2dd:5490:1)
    at processComponent (runtime-core.esm-bundler.js?d2dd:5448:1)
    at patch (runtime-core.esm-bundler.js?d2dd:5038:1)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?d2dd:5660:1)

Copy link
Member

@tsaglam tsaglam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor things...

@nestabentum nestabentum force-pushed the reportViewer_multiRoot branch from b20837b to bcd843b Compare August 19, 2022 13:07
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

43.9% 43.9% Coverage
0.0% 0.0% Duplication

Copy link
Member

@tsaglam tsaglam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! @nestabentum ready to merge from your end?

@nestabentum
Copy link
Contributor Author

@tsaglam this is good to go

@robinmaisch
Copy link
Contributor

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.

@tsaglam
Copy link
Member

tsaglam commented Aug 23, 2022

Should be already fixed by #607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR that involves features, improvements and other changes major Major issue/feature/contribution/change report-viewer PR / Issue deals (partly) with the report viewer and thus involves web-dev technologies
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants