Skip to content

Commit a69c3c3

Browse files
committed
fix(shots): tracked shot parsing
1 parent f63e1c7 commit a69c3c3

1 file changed

Lines changed: 54 additions & 20 deletions

File tree

src/app/stats/service.ts

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,10 @@ export const getTeamSeasonShootingStats = async (
796796
qb.and([
797797
qb('playType.name', '=', 'DunkShot'),
798798
qb('play.scoringPlay', '=', true),
799-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
799+
qb.or([
800+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
801+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
802+
]),
800803
]),
801804
)
802805
.as('dunksAssisted'),
@@ -825,7 +828,10 @@ export const getTeamSeasonShootingStats = async (
825828
qb.and([
826829
qb('playType.name', 'in', ['LayUpShot', 'LayupShot']),
827830
qb('play.scoringPlay', '=', true),
828-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
831+
qb.or([
832+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
833+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
834+
]),
829835
]),
830836
)
831837
.as('layupsAssisted'),
@@ -852,7 +858,7 @@ export const getTeamSeasonShootingStats = async (
852858
.countAll()
853859
.filterWhere((qb) =>
854860
qb.and([
855-
qb('playType.name', '=', 'JumpShot'),
861+
qb('playType.name', 'in', ['JumpShot', 'RegularJumpShot']),
856862
qb('play.scoreValue', '=', 2),
857863
]),
858864
)
@@ -863,7 +869,7 @@ export const getTeamSeasonShootingStats = async (
863869
.countAll()
864870
.filterWhere((qb) =>
865871
qb.and([
866-
qb('playType.name', '=', 'JumpShot'),
872+
qb('playType.name', 'in', ['JumpShot', 'RegularJumpShot']),
867873
qb('play.scoreValue', '=', 2),
868874
qb('play.scoringPlay', '=', true),
869875
]),
@@ -875,10 +881,13 @@ export const getTeamSeasonShootingStats = async (
875881
.countAll()
876882
.filterWhere((qb) =>
877883
qb.and([
878-
qb('playType.name', '=', 'JumpShot'),
884+
qb('playType.name', 'in', ['JumpShot', 'RegularJumpShot']),
879885
qb('play.scoreValue', '=', 2),
880886
qb('play.scoringPlay', '=', true),
881-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
887+
qb.or([
888+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
889+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
890+
]),
882891
]),
883892
)
884893
.as('twoPointJumpersAssisted'),
@@ -888,7 +897,7 @@ export const getTeamSeasonShootingStats = async (
888897
.countAll()
889898
.filterWhere((qb) =>
890899
qb.and([
891-
qb('play.playTypeId', 'in', [558, 30558]),
900+
qb('play.playTypeId', 'in', [558, 30558, 30495]),
892901
qb('play.scoreValue', '=', 3),
893902
]),
894903
)
@@ -899,7 +908,7 @@ export const getTeamSeasonShootingStats = async (
899908
.countAll()
900909
.filterWhere((qb) =>
901910
qb.and([
902-
qb('play.playTypeId', 'in', [558, 30558]),
911+
qb('play.playTypeId', 'in', [558, 30558, 30495]),
903912
qb('play.scoreValue', '=', 3),
904913
qb('play.scoringPlay', '=', true),
905914
]),
@@ -911,10 +920,13 @@ export const getTeamSeasonShootingStats = async (
911920
.countAll()
912921
.filterWhere((qb) =>
913922
qb.and([
914-
qb('play.playTypeId', 'in', [558, 30558]),
923+
qb('play.playTypeId', 'in', [558, 30558, 30495]),
915924
qb('play.scoreValue', '=', 3),
916925
qb('play.scoringPlay', '=', true),
917-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
926+
qb.or([
927+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
928+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
929+
]),
918930
]),
919931
)
920932
.as('threePointJumpersAssisted'),
@@ -1183,11 +1195,21 @@ export const getPlayerSeasonShootingStats = async (
11831195
'like',
11841196
sql<string>`CONCAT('%', athlete.name, ' made %')`,
11851197
),
1198+
eb(
1199+
'play.playText',
1200+
'like',
1201+
sql<string>`CONCAT('%', athlete.name, ' makes %')`,
1202+
),
11861203
eb(
11871204
'play.playText',
11881205
'like',
11891206
sql<string>`CONCAT('%', athlete.name, ' missed %')`,
11901207
),
1208+
eb(
1209+
'play.playText',
1210+
'like',
1211+
sql<string>`CONCAT('%', athlete.name, ' misses %')`,
1212+
),
11911213
]),
11921214
),
11931215
)
@@ -1233,7 +1255,10 @@ export const getPlayerSeasonShootingStats = async (
12331255
qb.and([
12341256
qb('playType.name', '=', 'DunkShot'),
12351257
qb('play.scoringPlay', '=', true),
1236-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1258+
qb.or([
1259+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1260+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
1261+
]),
12371262
]),
12381263
)
12391264
.as('dunksAssisted'),
@@ -1262,7 +1287,10 @@ export const getPlayerSeasonShootingStats = async (
12621287
qb.and([
12631288
qb('playType.name', 'in', ['LayUpShot', 'LayupShot']),
12641289
qb('play.scoringPlay', '=', true),
1265-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1290+
qb.or([
1291+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1292+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
1293+
]),
12661294
]),
12671295
)
12681296
.as('layupsAssisted'),
@@ -1289,7 +1317,7 @@ export const getPlayerSeasonShootingStats = async (
12891317
.countAll()
12901318
.filterWhere((qb) =>
12911319
qb.and([
1292-
qb('playType.name', '=', 'JumpShot'),
1320+
qb('playType.name', 'in', ['JumpShot', 'RegularJumpShot']),
12931321
qb('play.scoreValue', '=', 2),
12941322
]),
12951323
)
@@ -1300,7 +1328,7 @@ export const getPlayerSeasonShootingStats = async (
13001328
.countAll()
13011329
.filterWhere((qb) =>
13021330
qb.and([
1303-
qb('playType.name', '=', 'JumpShot'),
1331+
qb('playType.name', 'in', ['JumpShot', 'RegularJumpShot']),
13041332
qb('play.scoreValue', '=', 2),
13051333
qb('play.scoringPlay', '=', true),
13061334
]),
@@ -1312,10 +1340,13 @@ export const getPlayerSeasonShootingStats = async (
13121340
.countAll()
13131341
.filterWhere((qb) =>
13141342
qb.and([
1315-
qb('playType.name', '=', 'JumpShot'),
1343+
qb('playType.name', 'in', ['JumpShot', 'RegularJumpShot']),
13161344
qb('play.scoreValue', '=', 2),
13171345
qb('play.scoringPlay', '=', true),
1318-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1346+
qb.or([
1347+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1348+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
1349+
]),
13191350
]),
13201351
)
13211352
.as('twoPointJumpersAssisted'),
@@ -1325,7 +1356,7 @@ export const getPlayerSeasonShootingStats = async (
13251356
.countAll()
13261357
.filterWhere((qb) =>
13271358
qb.and([
1328-
qb('play.playTypeId', 'in', [558, 30558]),
1359+
qb('play.playTypeId', 'in', [558, 30558, 30495]),
13291360
qb('play.scoreValue', '=', 3),
13301361
]),
13311362
)
@@ -1336,7 +1367,7 @@ export const getPlayerSeasonShootingStats = async (
13361367
.countAll()
13371368
.filterWhere((qb) =>
13381369
qb.and([
1339-
qb('play.playTypeId', 'in', [558, 30558]),
1370+
qb('play.playTypeId', 'in', [558, 30558, 30495]),
13401371
qb('play.scoreValue', '=', 3),
13411372
qb('play.scoringPlay', '=', true),
13421373
]),
@@ -1348,10 +1379,13 @@ export const getPlayerSeasonShootingStats = async (
13481379
.countAll()
13491380
.filterWhere((qb) =>
13501381
qb.and([
1351-
qb('play.playTypeId', 'in', [558, 30558]),
1382+
qb('play.playTypeId', 'in', [558, 30558, 30495]),
13521383
qb('play.scoreValue', '=', 3),
13531384
qb('play.scoringPlay', '=', true),
1354-
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1385+
qb.or([
1386+
qb(qb.fn('lower', ['play.playText']), 'like', '% assisted by %'),
1387+
qb(qb.fn('lower', ['play.playText']), 'like', '% assists)'),
1388+
]),
13551389
]),
13561390
)
13571391
.as('threePointJumpersAssisted'),

0 commit comments

Comments
 (0)