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

Label Generator showing incorrect asset ID #289

Closed
6 tasks done
nikkojonasevie opened this issue Oct 16, 2024 · 8 comments · Fixed by #351
Closed
6 tasks done

Label Generator showing incorrect asset ID #289

nikkojonasevie opened this issue Oct 16, 2024 · 8 comments · Fixed by #351
Assignees
Labels
🕷️ bug Something isn't working

Comments

@nikkojonasevie
Copy link

First Check

  • This is not a feature request
  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • I can replicate the issue inside the Demo install.

Homebox Version

v0.15.2

What is the issue you are experiencing?

I had about 10 assets enters and everything seem to be fine. When I go to the label generator it appears some of my later assets are either not shown in the label generator or have the complete wrong asset id. What might I be doing wrong?

I was able to reproduce on the demo instance. Asset 000-009 and Asset 000-008 are showing incorrect on the label generator page

How can the maintainer reproduce the issue?

Create new item and go to label generator to see asset doesn't have correct asset id

Deployment

Docker (Linux)

OS Architechture

x86_64 (AMD, Intel)

Deployment Details

No response

@nikkojonasevie nikkojonasevie added the 🕷️ bug Something isn't working label Oct 16, 2024
@tankerkiller125
Copy link
Contributor

Can you share a screenshot of this from the Demo instance? I'm having some issues with replicating this because I don't quite understand what's not being displayed correctly. I have however found some significant issues with labels getting malformed by long item names (which I have committed a "fix" for that should be in nightly tomorrow)

@w1ntermute0
Copy link

w1ntermute0 commented Oct 17, 2024

I'm trying out homebox for the first time today so apologies if I'm doing something dumb but I noticed something similar. I created a few items and then imported about 20 items from CSV. When I generate the QR codes the asset ID (and the URL in the QR code) doesn't match the item name. It looks like maybe the asset names are sorted alphabetically and the asset IDs are sorted numerically and then these two lists are put together in that order to make the QR codes.

Image

Image

@nikkojonasevie
Copy link
Author

nikkojonasevie commented Oct 17, 2024

@tankerkiller125 the screen shot and issue @w1ntermute0 commented is exactly what I'm seeing as well. For some reason I can't access the demo instance anymore. Is it possibly down?

I don't believe the ones I have (like @w1ntermute0) are long names. I'm pretty sure I've replicated with the name "test"

@tankerkiller125
Copy link
Contributor

Thanks! This makes it much more clear, I'll be honest I didn't even think to check the asset ID number compared to names.

I'll take a look (or if @katosdev beats me to it he will), and we'll see if we can find and sort the problem.

@w1ntermute0
Copy link

Free free to ignore this because I am far from a skilled programmer, or even someone who understands all the syntax, but I like to tinker and I think this project is pretty great, so here's what I saw. I would have tested making changes here but I'm not sure how to do that since I'm running on a docker container:

Looks like if the data coming back from api.items.getAll() is not sorted, then the for loop index "i" which only originates from the users input in the "Asset Start" box may not match the assetID. (this can also get extra strange if you use the up/down arrow buttons on the text box which increments by .01). If there's an easy way for me to locally to edit label-generator.vue in the docker I can mess with this to try and provide an actual code suggestion.

Image

@jronnblom
Copy link

Any fixes planned for this?

@w1ntermute0
Copy link

I've been trying to figure out git, VScode, async functions, and vue with limited success. I was able to make the labels generate correctly but this is probably at best inelegant and likely a dumb way to do it. Anyway in case it helps anyone, here are the sections of label-generator.vue that I changed, happy to share the whole file somehow if it's easier:

function getItem(n: number, myitem: { id: string; name: string; location: { name: string } } | null): LabelData {

    return {
      url: getQRCodeUrl(goodAssetIDs[n]),
      assetID: goodAssetIDs[n],
      name: myitem?.name ?? "_______________",
      location: myitem?.location?.name ?? "_______________",
    };
  }

below that I defined goodAssetIDs and filled it:

var goodAssetIDs: string[]=[];
  const { data: allFields } = await useAsyncData(async () => {
    const { data, error } = await api.items.getAll();

    if (error) {
      return [];
    }

    for (let i = displayProperties.assetRange; i < displayProperties.assetRangeMax; i++) {
        const myTemp = ( await api.items.get( data.items[i].id  )).data.assetId;
        goodAssetIDs[i]= myTemp;
        console.log("Found: " + myTemp);
      };

      return data;
  });

@katosdev katosdev self-assigned this Nov 2, 2024
@katosdev
Copy link
Contributor

katosdev commented Nov 2, 2024

I've been trying to figure out git, VScode, async functions, and vue with limited success. I was able to make the labels generate correctly but this is probably at best inelegant and likely a dumb way to do it. Anyway in case it helps anyone, here are the sections of label-generator.vue that I changed, happy to share the whole file somehow if it's easier:

function getItem(n: number, myitem: { id: string; name: string; location: { name: string } } | null): LabelData {

    return {
      url: getQRCodeUrl(goodAssetIDs[n]),
      assetID: goodAssetIDs[n],
      name: myitem?.name ?? "_______________",
      location: myitem?.location?.name ?? "_______________",
    };
  }

below that I defined goodAssetIDs and filled it:

var goodAssetIDs: string[]=[];
  const { data: allFields } = await useAsyncData(async () => {
    const { data, error } = await api.items.getAll();

    if (error) {
      return [];
    }

    for (let i = displayProperties.assetRange; i < displayProperties.assetRangeMax; i++) {
        const myTemp = ( await api.items.get( data.items[i].id  )).data.assetId;
        goodAssetIDs[i]= myTemp;
        console.log("Found: " + myTemp);
      };

      return data;
  });

Thanks! I’ll review this and sort something for tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕷️ bug Something isn't working
Projects
None yet
5 participants