Giter Club home page Giter Club logo

Comments (8)

bzupnick avatar bzupnick commented on July 21, 2024

update: After deleting all the transactions for this account (g/.*58543bed-6c70-4074-97ab-1a1c35b17a7d.*/d) and running the script again, it worked!

from import-ynab5.

RDslva avatar RDslva commented on July 21, 2024

I'm seeing a similar error, but I have not created transactions via the YNAB API ever.

@bzupnick , was your solution to delete all transactions from the offending account in the YNAB JSON file, and re-import?

from import-ynab5.

bzupnick avatar bzupnick commented on July 21, 2024

Weird. I wonder why it happens, though. What's your offending error and corresponding line in the json file?

And yeah, I deleted all the transactions from the account and re-imported. It was a "tracking" account so it didn't effect my budget at all

from import-ynab5.

RDslva avatar RDslva commented on July 21, 2024

That's strange, that happened with a tracking account for me as well, an investment account to be precise. I ended up actually having 2 accounts that were causing issues, both needed to be deleted for the import to go smoothly.

Ended up downloading VS code and manually deleting the offending account lines from the JSON via regex. ^.account-guid-here., for those curious.

from import-ynab5.

skrobul avatar skrobul commented on July 21, 2024

So I bumped onto the same bug while trying to import my transactions. The example offending transaction is:

  {"id":"790438ac-0d28-4031-9ba9-b3e349475356","date":"2021-08-03","amount":-4059,"memo":"Groceries PLN 21.58","cleared":"reconciled","approved":true,"flag_color":"green","account_id":"3e4e34a2-82d1-4f34-aa44-a10d75a188c1","payee_id":"ada7a8b8-e47b-4143-a9fb-9a407d5eec92","category_id":"29ae8dc4-2534-4a9a-b1cd-25aa07fd70b9","transfer_account_id":null,"transfer_transaction_id":null,"matched_transaction_id":null,"import_id":"YNAB:-4059:2021-08-03:1","deleted":false} 

This is what I have tried so far with no results:

  • changing the amount to sth else -14059 which resulted in updated error message of Can't convert to integer -1405.9 as expected
  • setting import_id to null - no difference
  • changing flag_color to null. no difference
  • removing transaction memo in case numbers in description are throwing it off - no difference

So I looked into the code and it's this function throwing the error:

function ct(e, t) {
    if (void 0 === e) throw new Error("Query value cannot be undefined");
    if (null === e) return "boolean" === t ? 0 : null;
    switch (t) {
        case "date":
            if (e instanceof Date) return V($e(e));
            if (null == e.match(/^\d{4}-\d{2}-\d{2}$/) || e.date < "2000-01-01") throw new Error("Invalid date: " + e);
            return V(e);
        case "date-month":
            return V(e.slice(0, 7));
        case "date-year":
            return V(e.slice(0, 4));
        case "boolean":
            return e ? 1 : 0;
        case "id":
            if ("string" != typeof e && null !== e) throw new Error("Invalid id, must be string: " + e);
            return e;
        case "integer":
            if ("number" == typeof e && (0 | e) === e) return e;
            throw new Error("Can't convert to integer: " + JSON.stringify(e));
        case "json":
            return JSON.stringify(e)
    }
    return e
}

specifically, it's the (0 | e) === e) condition that is not matched because -1405.9 | 0 gives -1405.
So it looks like those are just amounts that have not been rounded properly. In my case, these have also been created by a script (like in @bzupnick's case). I will figure out some script to fix those to be round numbers.

from import-ynab5.

rienafairefr avatar rienafairefr commented on July 21, 2024

Same bug here. All my transactions are written through the YNAB API :-)

from import-ynab5.

bzupnick avatar bzupnick commented on July 21, 2024

here's a PR that fixes this problem

from import-ynab5.

bzupnick avatar bzupnick commented on July 21, 2024

fix got merged

from import-ynab5.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.