EddieDover / fvtt-party-sheet

A module for FoundryVTT providing a system-agnostic JSON-templated party sheet.
MIT License
3 stars 4 forks source link

[Feature Request] Sum total of rows #40

Open LeCuay opened 1 month ago

LeCuay commented 1 month ago

Summary

Yet another request 😅.

For total party wealth basically but I think it's a great addition in general.

This could get tricky since it'd require for a single row to iterate all actors in order to retrieve values as array or for adding them to a common property.

It might be a good idea to wait for #38

EddieDover commented 1 month ago

I like how these feature requests just get more and more complicated.

Honestly not sure how I would pull this off in a graceful manner. I'll have to think about how possible it is and get back to you.

EddieDover commented 1 month ago

It took a bit of work but... image

Now, that being said, I'm not 100% sure I'm happy with this implementation or the jank I had to pull to get this to work. I want nothing more than to give the users of my modules exactly what they want, but I'm not sure the cost of this feature is worth the value it brings.

As it stands, I added a type for total. Whatever text is fed into total, gets treated like the type is direct, however in the background the total is ... totaled and stored elsewhere. During runtime the direct value is displayed, until the bottom of the table where I'm running another loop, similar to how I generate the column headers, that instead generates column totals. This requires added a special field, just the text that was used in the column, so it can be referenced after it's converted by the direct parser.

Unfortunately, I'm not sure what I can do about all the extra border lines without adding a ton of customization options and then having to work those in etc.

AND, this really only works for ints. If I make things floats, then I have to worry about precision because if people start using ints, they'll get .00 decimal spots, etc.

I almost want to make a separate section on the popup, with it's own JSON, just to display 'total values' then this might be a lot more clean.

LeCuay commented 1 month ago

It took a bit of work but... image

Now, that being said, I'm not 100% sure I'm happy with this implementation or the jank I had to pull to get this to work. I want nothing more than to give the users of my modules exactly what they want, but I'm not sure the cost of this feature is worth the value it brings.

As it stands, I added a type for total. Whatever text is fed into total, gets treated like the type is direct, however in the background the total is ... totaled and stored elsewhere. During runtime the direct value is displayed, until the bottom of the table where I'm running another loop, similar to how I generate the column headers, that instead generates column totals. This requires added a special field, just the text that was used in the column, so it can be referenced after it's converted by the direct parser.

Unfortunately, I'm not sure what I can do about all the extra border lines without adding a ton of customization options and then having to work those in etc.

AND, this really only works for ints. If I make things floats, then I have to worry about precision because if people start using ints, they'll get .00 decimal spots, etc.

I almost want to make a separate section on the popup, with it's own JSON, just to display 'total values' then this might be a lot more clean.

Yeah... This one is gonna the most difficult. Not only because of the iteration within the loop but also the information displayed. I recommended to wait for #38 because the solution might go via a single column with full rowspan in order to display party gold

EddieDover commented 1 month ago

I actually did this work branching from #38

And now that I think about it, I did implement colSpan the same way as rowSpan, so there may be a way track the empty cells then colspan between them and use right-aligned text. Not sure.