Michael-Beutling / equateplus-moneymoney

MoneyMoney Plugin for equateplus share depot
MIT License
8 stars 5 forks source link

Naming positions #6

Open jkbecker opened 5 years ago

jkbecker commented 5 years ago

Hi Michael,

great little extension! My wife just asked me if Equateplus works with MoneyMoney and I was happy to be able to set something up! I noticed that each position shows up as (Unbekannt) in the list: 600b9497-9f59-4de3-a923-efcfe8e62e13 Our quick fix was to add notes to each position in order to identify them.

I've never written a Lua scraper before, and so I don't know how hard this is, but I'm wondering if the titles could just be pulled from these areas on the Equateplus page: 01c8d812-2b86-473a-ba89-c28bca7ee4c6

I'm not sure if you're even scraping that page or something else, but I assume there must be some kind of description attached to a position that can be imported?

Thanks for your great work!

Michael-Beutling commented 5 years ago

Hi jkbecker,

I open a branch (bugfixing) with a more verbose version https://github.com/Michael-Beutling/equateplus-moneymoney/blob/bugfixing/EquatePlus.lua.

After Download and install open a new Account as "EquatePlus (Debug2, don't use!)".

This version dump the whole data in a text file, don't post that!

In a terminal window enter (is one line): cat ~/Library/Containers/com.moneymoney-app.retail/Data/debug_EquatePlus.txt |grep entriesConfig.VEHICLE_DESCRIPTION.attributeName

You get many lines (hopefully) similar:

.entries.1.entries.1.entriesConfig.VEHICLE_DESCRIPTION.attributeName: string='VEHICLE_DESCRIPTION'

What is Your string value?

with best regards Michael

jkbecker commented 5 years ago

Ok, so my pull request #7 solves the quick & dirty for this issue and results in the following output:

Screenshot 2019-11-18 at 22 46 19

The problem was that in my case, there was no VEHICLE DESCRIPTION, and instead there was a PLAN_DESCRIPTION, as you can see in the code. Feel free to make the code more elegant, I literally wrote my first lines of Lua today and don't expect it to look good, even though it seems to work.

However, this depot is an employee share account, which means that some shares are purchased by the employee, and some are purchased by the company. This information is not part of the individual entries! Instead, it seams like the actual securities (shown above) are listed in entry.X.entry.2, entry.X.entry.3, etc. and entry.X.entry.1 is a different kind of element which does not contain a PLAN_DESCRIPTION but instead contains a ELECTION_CONTRIBUTION_TYPE which is either 'Ihr Beitrag' or 'Arbeitgeberzuschuss'.

My idea was to format the security name as secName=v["PLAN_DESCRIPTION"]..": "..v["ELECTION_CONTRIBUTION_TYPE"], but since they are not actually in the same element, this does NOT work :(

The weird thing is, the first elements entry.X.entry.1 seem to get skipped in the loop entirely! I made another branch that attempts to collect the ELECTION_CONTRIBUTION_TYPE and then reinsert them later, but they are never collected.

See here: This line is never reached!

The code in this branch is supposed to produce the following output, but since contribType is never populated, it does not work.

with contribType

I anonymized the logfiles for the first entry group and pasted it here. Maybe you can see what the issue is? https://gist.github.com/jkbecker/6a1593bbb3d1a1d1bcb2f7014c7952ad

Michael-Beutling commented 5 years ago

Hi Johannes,

I have push some commits, the last commit should be fix contribType problem.

My biggest problem is that I don't understand the relationship between ELECTION_CONTRIBUTION_TYPE entries and the PLAN_DESCRIPTION entries. I'm afraid that is doing in the javascript part. A hardcoded solution looks a little bit dirty.

I improve again the debug function, now is the output split in anonymized part and in a key/value part to "encrypt" the first part. My hope is, that in the summary or later in the details are the relationship between ELECTION_CONTRIBUTION_TYPE and PLAN_DESCRIPTION are made.

jkbecker commented 5 years ago

Hi Michael, agreed, the relationship between ELECTION_CONTRIBUTION_TYPE and PLAN_DESCRIPTION is very confusing, and honestly I don't have an idea why it is implemented that way at all... I'm fine with just ignoring it for now, it works well enough and this could be a very obscure edge case only relevant to Allianz employees who purchased stock through the employee shares program. I mostly wanted to document this somehow so I know where to pick up in case I want to give it another try, or so that other people who have the same issue can confirm that they are seeing the same data structure, which would indicated that it is more common than just a rare edge case.

Michael-Beutling commented 4 years ago

Hi Johannes, work the latest version for You?