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

Feature suggestion: truncate floats to specific number of decimal when setting colors #46

Open
mcintyre321 opened this issue Jun 12, 2020 · 1 comment

Comments

@mcintyre321
Copy link

I noticed that setting a cell value (or background colour, or note, etc.) always results in an entry in table.batches, even if you are setting the value to the initial value. This then results in the sheet changing

I can check it manually of course

   if item.get_field_value(score_name) != score_entry['value']:
                item.set_field_value(score_name, score_entry['value'])
    
    table.commit()

but it could be built into the library by caching the initial value, and checking it. You might want this as opt-in option on Table though.

Also it might not be easy to do for background colour. Setting a color like #80FF80 in sheetfu gets stored by sheets as backgroundColor": {"red": 0.5019607843137255, "green": 1.0, "blue": 0.5019607843137255}, so the setting #80FF80 will always look like a change.

@philippe2803
Copy link
Contributor

Regarding your first point, I think we should keep it as it is, and prevent doing too much comparison on data. If the set method is called, I would insist that an action should be made even if existing value and value being sent are the same. In addition, because we are batching those requests, we're essentially making just one request to Google API at the end and the gain in peprformance is debatable.

On the color settings however, you're making a very good point. I suppose we could truncate at a certain number of decimals (4 or 5 maybe?).

I'm currently working on a few features that have been asked, I could easily add the float thingy in here without issue.

@philippe2803 philippe2803 changed the title Feature suggestion: avoid sending unchanged cell data Feature suggestion: truncate floats to specific number of decimal when setting colors Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants