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

Infographic Widgets - Support widget selection also according to current request params #2573

Closed
ziv17 opened this issue Feb 23, 2024 · 3 comments · Fixed by #2574
Closed
Assignees

Comments

@ziv17
Copy link
Collaborator

ziv17 commented Feb 23, 2024

Currently the decision whether a widget is included takes place after its items are generated, before insertion to cache. Cache is based only on location

We want to add the ability to select widgets also according to current request parameters that are not location, e.g. news-flash text.

@ziv17 ziv17 self-assigned this Feb 23, 2024
@ziv17
Copy link
Collaborator Author

ziv17 commented Feb 23, 2024

Implementation suggestion:

  • Widgets that need to be included according to current data, will set their is_included() to return True whenever their data is not empty.
  • We will use Shani's method update_result(), that receives the current request parameters, and the data that was retrieved from cache. In this method the logic of whether the widget should be included will take place, according to both the items, and the current request parameters.

@atalyaalon , is this along the lines you intended?

@ziv17 ziv17 changed the title Infographic Widgets - Support widget selection also according to current input Infographic Widgets - Support widget selection also according to current request params Feb 23, 2024
@atalyaalon
Copy link
Collaborator

Implementation suggestion:

  • Widgets that need to be included according to current data, will set their is_included() to return True whenever their data is not empty.
  • We will use Shani's method update_result(), that receives the current request parameters, and the data that was retrieved from cache. In this method the logic of whether the widget should be included will take place, according to both the items, and the current request parameters.

@atalyaalon , is this along the lines you intended?

Yes, I assume that in some cases we would like to have an "AND" between data logic and request parameters logic (for example, X pedestrians were injured in street AND "הולך רגל" is in news flash text) and in some cases we would like to have an "OR between them (for example, X pedestrians were injured in street OR "הולך רגל" is in news flash text)

If we have an "OR" the result of each trigger will be the same - the appearance of the widget in the cache data.

@ziv17
Copy link
Collaborator Author

ziv17 commented Feb 23, 2024

Implementation suggestion:

  • Widgets that need to be included according to current data, will set their is_included() to return True whenever their data is not empty.
  • We will use Shani's method update_result(), that receives the current request parameters, and the data that was retrieved from cache. In this method the logic of whether the widget should be included will take place, according to both the items, and the current request parameters.

@atalyaalon , is this along the lines you intended?

Yes, I assume that in some cases we would like to have an "AND" between data logic and request parameters logic (for example, X pedestrians were injured in street AND "הולך רגל" is in news flash text) and in some cases we would like to have an "OR between them (for example, X pedestrians were injured in street OR "הולך רגל" is in news flash text)

If we have an "OR" the result of each trigger will be the same - the appearance of the widget in the cache data.

It is supported by the current structure. The update_result() of the widget can implement the needed logic of that widget. It can alter the widget's data, and it can return None, to remove the widget from the result of the current request.

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

Successfully merging a pull request may close this issue.

2 participants