xanthics / gw2craft

Driving force behind gw2crafts
http://gw2crafts.net
MIT License
68 stars 16 forks source link

Request: Update the projected cost when API Key is inserted #34

Closed Rushleader closed 6 years ago

Rushleader commented 7 years ago

When loading the API Key parse the already possessed mats and subtract that from the projected cost so you have an indication what your cost is

TomKriek commented 6 years ago

@xanthics is it okay if I try and make a jQuery function which recalculates the total cost when amount are being changed via API update or input element changes? I might have to pull some data to the front since you already format the amount in xxg xxs xxc should be fairly easy to make this dynamic.

xanthics commented 6 years ago

@TomKriek You certainly can. I can also put the raw copper price per item as a field somewhere, if that makes it easier.

TomKriek commented 6 years ago

Yeah that would be perfect, I saw you using a single variable for the amount of copper for the items. If you could place that somewhere around the "Have" "Need" with a class.

Something along the lines of

<span style="display:none;" class="coins">[copper_amount]</span>
xanthics commented 6 years ago

I've added a raw_copper field that can have values of 0 or higher to all of the cells that have the field data-need="more|done"

<input type="number" id="19699bv" value='72' raw_copper='264' readonly data-need = "more" min="0" />
TomKriek commented 6 years ago

Perfect, I have time this weekend to work on the recalculation of the total cost. Thanks for the update.

TomKriek commented 6 years ago

@xanthics I'll be able to wrap up the function for recalculating upcoming Wednesday. Would it be possible by any chance to get more of those raw copper fields on the Sell List items? I will be able to update the full Initial Cost + Expected Recovery and Expected Final Cost with those extra fields.

xanthics commented 6 years ago

@TomKriek Got distracted and forgot to reply. Why would those items need fields? I can add one for the expected recovery field, but the other ones shouldn't need it.

TomKriek commented 6 years ago

@xanthics With extra copper fields on the Sell List items I can make a total calculation of cost and recovered gold. If I just calculate the cost and update that amount the total money spent won't add up in the shown calculation on the website. Right now I have costs (calculation from the current copper fields) if I can calculate recovered money I can calculate the total loss/profit and update all three values accordingly.

Seemed the most logical to me. I got distracted as well with PoF launch :P I'll try and finish the function and formatting function and make a PR you should be able to hook up the jQuery easily enough.

xanthics commented 6 years ago

Should be fixed now.