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

Give a fixed order for this API #291

Open
dadiorchen opened this issue Mar 15, 2023 · 6 comments
Open

Give a fixed order for this API #291

dadiorchen opened this issue Mar 15, 2023 · 6 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers priority released

Comments

@dadiorchen
Copy link
Contributor

The bug is: if request this https://prod-k8s.treetracker.org/query/trees?organization_id=193&limit=1000 we got a random list every time, you can request it multiple times, and the return list differs.

Is this because the order is random? If this is the case, please give a default order for the list, for example, order by created time.


Some hints:

  • Please read our readme for more information/guide/tutorial.
  • Here is an engineering book in Greenstand.
  • To know more about our organization, visit our website.
  • If you want to join the slack community (some resources need the community member's permission), please leave your email address.
@dadiorchen dadiorchen added bug Something isn't working good first issue Good for newcomers priority labels Mar 15, 2023
@kunalznk
Copy link
Contributor

hello can u assign it to me

@jeremydthomas
Copy link
Member

of course

kunalznk added a commit to kunalznk/treetracker-query-api that referenced this issue Mar 16, 2023
kunalznk added a commit to kunalznk/treetracker-query-api that referenced this issue Mar 16, 2023
dadiorchen added a commit that referenced this issue Mar 17, 2023
fix: #291 tress order by default time_created
@github-actions
Copy link

🎉 This issue has been resolved in version 1.62.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dadiorchen
Copy link
Contributor Author

@kunalznk can you check the url, I found the problem is still there:

This is the SQL on the log:

{
7117   method: 'raw',
7118   sql: '\n' +
7119     '      SELECT\n' +
7120     '      trees.*,\n' +
7121     '      tree_species.id as species_id,\n' +
7122     '      tree_species.name as species_name,\n' +
7123     '      region.id as country_id,\n' +
7124     '      region.name as country_name,\n' +
7125     '      entity.id as organization_id,\n' +
7126     '      entity.name as organization_name\n' +
7127     '      FROM trees\n' +
7128     '      LEFT JOIN planter ON trees.planter_id = planter.id\n' +
7129     '      LEFT JOIN entity ON entity.id = planter.organization_id\n' +
7130     '      LEFT JOIN tree_species \n' +
7131     '        on trees.species_id = tree_species.id \n' +
7132     '      LEFT JOIN region\n' +
7133     '        on ST_WITHIN(trees.estimated_geometric_location, region.geom)\n' +
7134     "        and region.type_id in (select id from region_type where type = 'country')\n" +
7135     '      WHERE\n' +
7136     '        (\n' +
7137     '          planter.organization_id in ( SELECT entity_id from getEntityRelationshipChildren(193))\n' +
7138     '        OR\n' +
7139     '          trees.planting_organization_id = 193\n' +
7140     '        )\n' +
7141     '      LIMIT 100\n' +
7142     '      OFFSET 0\n' +
7143     '    ',
7144   bindings: [],
7145

We are missing the orderBy, do you know how to open the SQL log locally? You can check the SQL created on your side, so you can tell what's happening.

@kunalznk
Copy link
Contributor

Okay I'll check it

@dadiorchen
Copy link
Contributor Author

Let me know if you need help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers priority released
Projects
None yet
Development

No branches or pull requests

3 participants