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

Allow editing of asset number #5651

Merged
merged 3 commits into from
Dec 2, 2024
Merged

Allow editing of asset number #5651

merged 3 commits into from
Dec 2, 2024

Conversation

CarlosNZ
Copy link
Contributor

Fixes #5392

πŸ‘©πŸ»β€πŸ’» What does this PR do?

This is the simplest version of this -- it just makes the Asset number editable after the asset is created. I'll make a follow-up issue to get user input on scanning, as that's a bit more involved and could do with some further planning to make it work nicely.

πŸ’Œ Any notes for the reviewer?

I notice we're not enforcing unique-ness for Asset number. Should it be?

πŸ§ͺ Testing

  • Go to an Asset detail page
  • Can edit the Asset Number
  • Can save, and Asset number is updated in the Breadcrumb title at the top of the page

@github-actions github-actions bot added this to the v2.4.1 milestone Nov 29, 2024
@github-actions github-actions bot added enhancement New feature or request Priority: Must Have The product will not work without this labels Nov 29, 2024
@CarlosNZ
Copy link
Contributor Author

Follow-up: #5652

Copy link

Bundle size difference

Comparing this PR to main

Old size New size Diff
4.99 MB 4.99 MB 186 B (0.00%)

@adamdewey
Copy link
Contributor

I notice we're not enforcing unique-ness for Asset number. Should it be?

It would be nice, but not sure how we would do it if assets can be added offline?

@CarlosNZ CarlosNZ requested a review from jmbrunskill November 29, 2024 03:24
@jmbrunskill
Copy link
Contributor

We an asset number duplication check in the insert method.
Now that we're updateing it from upsert it should be there too

    if let Some(asset_number) = &input.asset_number {
        if check_asset_number_exists(asset_number, connection)?.len() >= 1 {
            return Err(InsertAssetError::AssetNumberAlreadyExists);
        }
    }

Can you add this to the validate method in the update please?

I agree @adamdewey we can't guarentee it doesn't get duplicated with sync but would be good to keep it unique for a site at least.

Copy link
Contributor

@jmbrunskill jmbrunskill left a comment

Choose a reason for hiding this comment

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

Approved, but can you add that duplication check, or put a follow up issue for that to be picked up refactor week?

@jmbrunskill
Copy link
Contributor

jmbrunskill commented Dec 1, 2024

Can you add this to the validate method in the update please?

On second thoughts I think we'll need to make it check that it's not the same id that the current asset is using.
I think a follow up issue is fine...

@CarlosNZ CarlosNZ merged commit 1d22055 into v2.4.1 Dec 2, 2024
4 checks passed
@CarlosNZ CarlosNZ deleted the 5392-edit-asset-num-v2.4.1 branch December 2, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature: CCEI feature: GAPS Priority: Must Have The product will not work without this Team Piwakawaka James, Carl, John, Zachariah
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow user to enter an asset number when creating an asset via 2d Matrix Barcode Scan
3 participants