Skip to content

Commit

Permalink
fix: exclude dlc from platforms and genres stats (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 authored Nov 1, 2024
1 parent 8e5f79c commit 28ee7e9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Binary file modified GamesPassionFR.db
Binary file not shown.
2 changes: 1 addition & 1 deletion GamesPassionFR.sqbpro
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="GamesPassionFR.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="3"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="3140"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><table title="all_series_as_json" custom_title="0" dock_id="1" table="4,18:mainall_series_as_json"/><table title="games" custom_title="0" dock_id="2" table="4,5:maingames"/><dock_state state="000000ff00000000fd00000001000000020000043c000002b6fc0100000001fc000000000000043c0000011e00fffffffa000000010100000002fb000000160064006f0063006b00420072006f00770073006500310100000000ffffffff0000011e00fffffffb000000160064006f0063006b00420072006f00770073006500320100000000ffffffff0000011b00ffffff0000043c0000000000000004000000040000000800000008fc00000000"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="all_series_as_json" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="156"/><column index="2" value="429"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="backlog" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="31"/><column index="2" value="300"/><column index="3" value="58"/><column index="4" value="257"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort><column index="0" mode="0"/></sort><column_widths><column index="1" value="31"/><column index="2" value="93"/><column index="3" value="273"/><column index="4" value="300"/><column index="5" value="85"/><column index="6" value="70"/><column index="7" value="58"/><column index="8" value="70"/><column index="9" value="41"/></column_widths><filter_values><column index="3" value="prince "/></filter_values><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games_available_time" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="40"/><column index="2" value="53"/><column index="3" value="53"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games_genres" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="41"/><column index="2" value="42"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games_schedules" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="31"/><column index="2" value="85"/><column index="3" value="85"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1*">SELECT * FROM dlcs_as_json</sql><current_tab id="0"/></tab_sql></sqlb_project>
<?xml version="1.0" encoding="UTF-8"?><sqlb_project><db path="GamesPassionFR.db" readonly="0" foreign_keys="1" case_sensitive_like="0" temp_store="0" wal_autocheckpoint="1000" synchronous="2"/><attached/><window><main_tabs open="structure browser pragmas query" current="3"/></window><tab_structure><column_width id="0" width="300"/><column_width id="1" width="0"/><column_width id="2" width="100"/><column_width id="3" width="3140"/><column_width id="4" width="0"/><expanded_item id="0" parent="1"/><expanded_item id="1" parent="1"/><expanded_item id="2" parent="1"/><expanded_item id="3" parent="1"/></tab_structure><tab_browse><table title="genres_stats" custom_title="0" dock_id="2" table="4,12:maingenres_stats"/><table title="all_series_as_json" custom_title="0" dock_id="1" table="4,18:mainall_series_as_json"/><dock_state state="000000ff00000000fd00000001000000020000043c000002b6fc0100000001fc000000000000043c0000011e00fffffffa000000000100000002fb000000160064006f0063006b00420072006f00770073006500310100000000ffffffff0000011e00fffffffb000000160064006f0063006b00420072006f00770073006500320100000000ffffffff0000011e00ffffff0000043c0000000000000004000000040000000800000008fc00000000"/><default_encoding codec=""/><browse_table_settings><table schema="main" name="all_series_as_json" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="156"/><column index="2" value="300"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="backlog" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="31"/><column index="2" value="300"/><column index="3" value="58"/><column index="4" value="257"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort><column index="0" mode="0"/></sort><column_widths><column index="1" value="31"/><column index="2" value="93"/><column index="3" value="273"/><column index="4" value="300"/><column index="5" value="85"/><column index="6" value="70"/><column index="7" value="58"/><column index="8" value="70"/><column index="9" value="41"/></column_widths><filter_values><column index="3" value="prince "/></filter_values><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games_available_time" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="40"/><column index="2" value="53"/><column index="3" value="53"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games_genres" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="41"/><column index="2" value="42"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="games_schedules" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="31"/><column index="2" value="85"/><column index="3" value="85"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table><table schema="main" name="genres_stats" show_row_id="0" encoding="" plot_x_axis="" unlock_view_pk="_rowid_" freeze_columns="0"><sort/><column_widths><column index="1" value="29"/><column index="2" value="93"/><column index="3" value="34"/><column index="4" value="91"/><column index="5" value="105"/></column_widths><filter_values/><conditional_formats/><row_id_formats/><display_formats/><hidden_columns/><plot_y_axes/><global_filter/></table></browse_table_settings></tab_browse><tab_sql><sql name="SQL 1"></sql><current_tab id="0"/></tab_sql></sqlb_project>
7 changes: 4 additions & 3 deletions generateJsonFiles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ async function extractAndSaveStats(db) {
const games_total_time = db.prepare("SELECT * FROM games_total_time").get();
const games_total_time_available = db.prepare("SELECT * FROM games_available_time").get();
const games_total_time_unavailable = db.prepare("SELECT * FROM games_unavailable_time").get();
const total_games = db.prepare("SELECT COUNT(*) FROM games").pluck().get();
const total_game_available = db.prepare("SELECT COUNT(*) FROM games_in_present").pluck().get();
const total_game_unavailable = db.prepare("SELECT COUNT(*) FROM games_in_future").pluck().get();
// where condition needed to exclude dlc from game resultset
const total_games = db.prepare("SELECT COUNT(*) FROM games WHERE id NOT IN (SELECT dlc FROM games_dlcs)").pluck().get();
const total_game_available = db.prepare("SELECT COUNT(*) FROM games_in_present WHERE id NOT IN (SELECT dlc FROM games_dlcs)").pluck().get();
const total_game_unavailable = db.prepare("SELECT COUNT(*) FROM games_in_future WHERE id NOT IN (SELECT dlc FROM games_dlcs)").pluck().get();

const result = {
"platforms": platformStats,
Expand Down
12 changes: 6 additions & 6 deletions src/app/api/stats/stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
{
"id": 6,
"platform": "PS3",
"total": 64,
"total_available": 42,
"total_unavailable": 24
"total": 62,
"total_available": 41,
"total_unavailable": 23
},
{
"id": 5,
Expand Down Expand Up @@ -186,9 +186,9 @@
}
],
"general": {
"total": 191,
"total_available": 165,
"total_unavailable": 28,
"total": 189,
"total_available": 164,
"total_unavailable": 27,
"channel_start_date": "2014-04-15T17:35:16+00:00",
"total_time": {
"hours": 996,
Expand Down

0 comments on commit 28ee7e9

Please sign in to comment.