-
Notifications
You must be signed in to change notification settings - Fork 0
Adds a fast basket endpoint and functions #21
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
base: main
Are you sure you want to change the base?
Conversation
| model_name='bandingtypecurrencyentry', | ||
| index=models.Index(fields=['package', 'banding_type_entry'], name='btce_pkg_bte_idx'), | ||
| ), | ||
| migrations.AddIndex( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure how helpful this index will be, as the bandingtypeentry is probably shared by many rows
| else: | ||
| self.helper.layout.append( | ||
| Layout( | ||
| HTML( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat curious offloading the HTML generation into this routine, rather than using a template?
| return prices | ||
|
|
||
| @functools.cached_property | ||
| def fast_price_bandings(self) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK, but I really would like it to have a debug/logging mode where it writes output about what it is doing to the price debugger. Could just add an optional parameter to the function debug=False that when true then returns a tuple of (prices, debug_string). This way we could easily hook it up to the debugger? I am just worried that, although it all looks fine at this point, we might hit an edge case with OBC where we can't work out what it's doing and need to debug the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This might be the wrong place for this comment. I can see that other functions still have the "explain" bool signature, below, so perhaps the debugger is still in tact
| def _compare(self, package): | ||
| original = package.price_bandings | ||
|
|
||
| if "fast_price_bandings" in package.__dict__: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code is forcing a cached property to reload, but it's hard to understand. It looks like the code deletes an instance attribute but then accesses it immediately...
No description provided.