Skip to content

feat: skip duplicates#105

Merged
skynet2 merged 4 commits intomasterfrom
skip-duplicates-2
Feb 21, 2026
Merged

feat: skip duplicates#105
skynet2 merged 4 commits intomasterfrom
skip-duplicates-2

Conversation

@skynet2
Copy link
Member

@skynet2 skynet2 commented Feb 21, 2026

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @skynet2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the transaction import functionality by providing users with more flexibility when dealing with transactions that have identical reference numbers. Previously, importing transactions with duplicate references would result in an error. Now, users can choose to bypass this strict check, allowing the system to automatically resolve duplicate references by making them unique, thereby streamlining the import process for datasets that may contain such entries.

Highlights

  • Duplicate Reference Handling: Introduced a new option to skip duplicate reference checks during transaction import. When enabled, the system will automatically append a numeric suffix (e.g., _1, _2) to duplicate reference numbers instead of failing the import.
  • Frontend UI Update: Added a 'Skip Duplicate Reference Check' checkbox to the transaction import page, allowing users to control this new behavior directly from the UI.
  • Dependency Updates: Updated several Go and Node.js dependencies, including buf.build/gen/go and google.golang.org/protobuf for Go, and @buf/xskydev_go-money-pb.bufbuild_es for the frontend.
Changelog
  • frontend/package-lock.json
    • Updated @buf/xskydev_go-money-pb.bufbuild_es dependency version.
  • frontend/src/app/pages/transactions/transactions-import.component.html
    • Added a new checkbox input for skipDuplicateReferenceCheck.
  • frontend/src/app/pages/transactions/transactions-import.component.ts
    • Added skipDuplicateReferenceCheck boolean property to the component.
    • Passed the skipDuplicateReferenceCheck value to ParseTransactionsRequestSchema and ImportTransactionsRequestSchema.
  • go.mod
    • Updated buf.build/gen/go dependencies to newer versions.
    • Updated google.golang.org/protobuf dependency to version v1.36.11.
  • go.sum
    • Updated checksums for various Go module dependencies.
  • pkg/importers/importer.go
    • Imported the fmt package.
    • Modified the CheckDuplicates method to accept a skipDuplicateRefCheck boolean parameter.
    • Implemented logic within CheckDuplicates to append numeric suffixes to duplicate reference numbers if skipDuplicateRefCheck is true.
    • Updated Import and ParseInternal methods to pass the SkipDuplicateReferenceCheck flag to CheckDuplicates.
  • pkg/importers/importer_test.go
    • Updated existing CheckDuplicates test calls to include the new false parameter for skipDuplicateRefCheck.
    • Added a new test case to verify the behavior of CheckDuplicates when skipDuplicateRefCheck is true, ensuring suffixes are added to duplicate references.
Activity
  • skynet2 created this pull request to introduce a feature for skipping duplicate reference checks during transaction imports.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a feature to skip duplicate reference checks during transaction import. When this option is enabled, instead of erroring on duplicate references within the import data, it appends a suffix to make them unique. The changes span both the frontend, with a new checkbox in the UI, and the backend, where the core logic is implemented in pkg/importers/importer.go. The backend changes are well-tested. My main feedback is a suggestion to refactor a loop in the Go code for better readability and maintainability. Overall, a good addition.

Comment on lines +79 to +86
counter := 1
newRef := fmt.Sprintf("%s_%d", ref, counter)
for _, exists := refToItem[newRef]; exists; _, exists = refToItem[newRef] {
counter++
newRef = fmt.Sprintf("%s_%d", ref, counter)
}

validRefs[idx] = newRef

Choose a reason for hiding this comment

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

medium

This logic for finding a unique reference number can be simplified and made more readable. The current for loop is a bit unconventional. A clearer approach would be to loop until a unique newRef is found.

Suggested change
counter := 1
newRef := fmt.Sprintf("%s_%d", ref, counter)
for _, exists := refToItem[newRef]; exists; _, exists = refToItem[newRef] {
counter++
newRef = fmt.Sprintf("%s_%d", ref, counter)
}
validRefs[idx] = newRef
var newRef string
for counter := 1; ; counter++ {
newRef = fmt.Sprintf("%s_%d", ref, counter)
if _, exists := refToItem[newRef]; !exists {
break
}
}
validRefs[idx] = newRef

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.51%. Comparing base (5abe52b) to head (103b572).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #105      +/-   ##
==========================================
+ Coverage   87.48%   87.51%   +0.02%     
==========================================
  Files          83       83              
  Lines        6834     6847      +13     
==========================================
+ Hits         5979     5992      +13     
  Misses        611      611              
  Partials      244      244              
Flag Coverage Δ
unittests 87.51% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@skynet2 skynet2 merged commit 559ccd1 into master Feb 21, 2026
4 checks passed
@skynet2 skynet2 deleted the skip-duplicates-2 branch February 21, 2026 16:04
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