Skip to content

fix: issue #93 and fix: forcing checkstyle language to English#119

Open
a22407332FilipeMonteiro wants to merge 1 commit intodrop-project-edu:v1.0.0-beta.5from
a22407332FilipeMonteiro:fix/checkstyle-locale-en-v2
Open

fix: issue #93 and fix: forcing checkstyle language to English#119
a22407332FilipeMonteiro wants to merge 1 commit intodrop-project-edu:v1.0.0-beta.5from
a22407332FilipeMonteiro:fix/checkstyle-locale-en-v2

Conversation

@a22407332FilipeMonteiro
Copy link
Copy Markdown

PR Title

Fix missing indicator for Project Structure errors + Force English for test executio
Closes#93


Description

This PR addresses two issues:

  1. Submissions with Project Structure errors were displayed as "Validated" but showed no visual indicator in the "Indicators" column.
  2. Tests were failing on machines with non-English system locale (e.g. Portuguese).

Root Cause

Project Structure Indicator

In SubmissionService.kt, the reportElements were being fetched inside the buildReport?.let { } block. This meant that submissions without a buildReport (such as those with Project Structure errors) never had their reportElements populated, resulting in an empty Indicators column in the UI.

Locale Issue

While running the test suite, most of the tests were failling, but one message appeared in Portuguese, which was unexpected. After investigation, it became clear that having the OS language set to Portuguese was preventing the tests from executing correctly. Switching the system language to English allowed all tests to pass, confirming the root cause.


Solution

Project Structure Indicator

In SubmissionService.kt, moved the reportElements fetch outside of the buildReport?.let { } block, so that it is always executed regardless of whether a buildReport exists.

Before:

if (retrieveReport) {
    lastSubmission.buildReport?.let { buildReportDB ->
        val reportElements = submissionReportRepository.findBySubmissionId(lastSubmission.id)
        lastSubmission.reportElements = reportElements
        // ...
    }
}

After:

if (retrieveReport) {
    val reportElements = submissionReportRepository.findBySubmissionId(lastSubmission.id)
    lastSubmission.reportElements = reportElements

    lastSubmission.buildReport?.let { buildReportDB ->
        // ...
    }
}

Locale Fix

  • Added request.mavenOpts = "-Duser.language=en -Duser.country=US" in MavenInvoker.kt to force Maven to always run with English locale, regardless of the OS language.
  • After applying the fix, the system language was set back to Portuguese and all tests were confirmed to pass.

Result

  • Submissions remain "Validated" as intended.
  • A visual indicator (❌) is now shown when a Project Structure error exists.
  • UI feedback is now consistent with the build report.
  • All tests pass regardless of the system locale.

Testing

Project Structure Indicator

  1. Submit a project with an invalid structure (e.g., wrong package name).
  2. Log in as a teacher.
  3. Navigate to the submissions list.
  4. Verify that:
    • The submission status is "Validated"
    • A red cross (❌) appears in the Indicators column

Locale Fix

  1. Set system locale to Portuguese.
  2. Run the full test suite.
  3. Verify all tests pass without locale-related failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant