Skip to content

Fixing Bug/ssad 33 fix houses.zip#72

Merged
Sohatzk merged 8 commits into
devfrom
bug/SSAD-33-Fix-houses.zip
Mar 3, 2026
Merged

Fixing Bug/ssad 33 fix houses.zip#72
Sohatzk merged 8 commits into
devfrom
bug/SSAD-33-Fix-houses.zip

Conversation

@khomenko-a
Copy link
Copy Markdown
Contributor

dev

JIRA

Summary of issue

The database synchronization process in SaveToponymsToDbAsync was unoptimized (caused full table truncation and row-by-row insertion). Additionally, the path for houses.zip was hardcoded and the large binary file was tracked in the repository root.

Summary of change

  • Refactored SaveToponymsToDbAsync:
    • Replaced row-by-row operations with batch operations (CreateRange, DeleteRange) for better performance.
    • Implemented incremental updates: now the code calculates differences instead of recreating the whole table.
  • File Management:
    • Configured houses.zip to be downloaded at runtime to the Resources folder.
    • Added houses.csv to .gitignore to prevent tracking large files.

CHECK LIST

  • СI passed
  • Сode coverage >=95%
  • PR is reviewed manually again (to make sure you have 100% ready code)
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in and logged out user if needed
  • PR meets all conventions

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Feb 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

DrFaust555
DrFaust555 previously approved these changes Feb 11, 2026
Copy link
Copy Markdown
Contributor

@DrFaust555 DrFaust555 left a comment

Choose a reason for hiding this comment

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

Approved after the next remarks:

  1. Search for deletion — N+1 query:

foreach (var candidate in possibleToponymsToDelete)
{
var entity = await _repository.ToponymRepository.GetFirstOrDefaultAsync(t =>
t.Gromada == candidate.Gromada &&
t.Coordinate.Latitude == candidate.Coordinate.Latitude &&
...);
}
Each candidate is a separate query to the database. If dataToDelete has 100 records, it is 100 queries. It can be optimized through one GetAllAsync with Contains, but for Take(20) it is not critical.

Now I suspect the following (I need to check, I could be wrong myself!):

  1. News tests in PR:

PR contains 8 News test files from PR #63. You need to either rebase to the current dev (if #63 has already been merged), or it will be a conflict.

  1. .gitignore not updated:

The PR description says "adding houses.csv to .gitignore". houses.csv has been removed from git, but without .gitignore it can be re-committed.

Sohatzk
Sohatzk previously approved these changes Feb 13, 2026
@khomenko-a khomenko-a dismissed stale reviews from Sohatzk and DrFaust555 via 1ce1978 February 16, 2026 17:58
@DrFaust555
Copy link
Copy Markdown
Contributor

Add entries for houses.csv, data.csv and houses.zip to .gitignore so that they do not end up in the repo after local launch. Also fix N+1 query in SaveToponymsToDbAsync — now in the foreach loop for each candidate for deletion there is a separate GetFirstOrDefaultAsync query, this needs to be replaced with a single query that will extract all the necessary records. And remove lines from Controllers\Newss\ and Controllers\Analytics\ from .csproj — they are not relevant to your task.

@Sohatzk Sohatzk requested review from DrFaust555 and Sohatzk March 2, 2026 16:37
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 2, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Copy Markdown
Contributor

@DrFaust555 DrFaust555 left a comment

Choose a reason for hiding this comment

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

Approved

@Sohatzk Sohatzk merged commit eae4821 into dev Mar 3, 2026
2 of 3 checks passed
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.

3 participants