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

🐛 adapty row type close #85 #86

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
..
This file is part of LCCS-WS.
Copyright (C) 2022 INPE.
Copyright (C) 2023 INPE.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -25,10 +25,6 @@ Land Cover Classification System Web Service
:target: https://github.com/brazil-data-cube/bdc-catalog/blob/master/LICENSE
:alt: Software License

.. image:: https://drone.dpi.inpe.br/api/badges/brazil-data-cube/lccs-ws/status.svg
:target: https://drone.dpi.inpe.br/brazil-data-cube/lccs-ws
:alt: Build Status

.. image:: https://codecov.io/gh/brazil-data-cube/lccs-ws/branch/master/graph/badge.svg?token=XFD6QREW99
:target: https://codecov.io/gh/brazil-data-cube/lccs-ws
:alt: Code Coverage Test
Expand Down Expand Up @@ -95,7 +91,7 @@ License


.. admonition::
Copyright (C) 2022 INPE.
Copyright (C) 2023 INPE.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
10 changes: 7 additions & 3 deletions lccs_ws/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,18 @@ def get_mappings(system_id_or_identifier: str) -> Tuple[LucClassificationSystem,
classes_source = db.session.query(LucClass.id) \
.filter(LucClass.classification_system_id == system.id) \
.all()

classes_source_ids = [value for (value,) in classes_source]

targets_class_id = db.session.query(distinct(ClassMapping.target_class_id)) \
.filter(ClassMapping.source_class_id.in_(classes_source)) \
targets_classes = db.session.query(distinct(ClassMapping.target_class_id)) \
.filter(ClassMapping.source_class_id.in_(classes_source_ids)) \
.all()

targets_class_ids = [value for (value,) in targets_classes]

systems = db.session.query(LucClassificationSystem) \
.join(LucClass, LucClass.classification_system_id == LucClassificationSystem.id) \
.filter(LucClass.id.in_(targets_class_id)) \
.filter(LucClass.id.in_(targets_class_ids)) \
.all()

return system, systems
Expand Down