Skip to content

Commit e6e221e

Browse files
hellcpjwise
authored andcommitted
Support the hardware inheritance
1 parent a4b771f commit e6e221e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

appstore/api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
api = Blueprint('api', __name__)
1414
CORS(api)
1515

16+
HARDWARE_SUPPORT = {
17+
'aplite': ['aplite'],
18+
'basalt': ['basalt', 'aplite'],
19+
'chalk': ['chalk'],
20+
'diorite': ['diorite', 'aplite'],
21+
'emery': ['emery', 'diorite', 'basalt', 'aplite'],
22+
'flint': ['flint', 'diorite', 'aplite']
23+
}
24+
1625

1726
def generate_app_response(results, sort_override=None):
1827
target_hw = request.args.get('hardware', 'basalt')
@@ -53,7 +62,7 @@ def hw_compat(hw):
5362
_compat = (db.session.query(Release.compatibility, Release.app_id)
5463
.order_by(Release.published_date.desc())
5564
.subquery())
56-
return and_(_compat.c.compatibility.contains([hw]), _compat.c.app_id == App.id)
65+
return and_(_compat.c.compatibility.overlap(HARDWARE_SUPPORT[hw]), _compat.c.app_id == App.id)
5766

5867

5968
def global_filter(hw):

0 commit comments

Comments
 (0)