1
0
mirror of synced 2025-02-15 09:52:35 +01:00

32 Commits

Author SHA1 Message Date
beerpsi
58a5177a30 use SQL's limit/offset pagination for nextIndex/maxCount requests (#185)
Instead of retrieving the entire list of items/characters/scores/etc. at once (and even store them in memory), use SQL's `LIMIT ... OFFSET ...` pagination so we only take what we need.

Currently only CHUNITHM uses this, but this will also affect maimai DX and O.N.G.E.K.I. once the PR is ready.

Also snuck in a fix for CHUNITHM/maimai DX's `GetUserRivalMusicApi` to respect the `userRivalMusicLevelList` sent by the client.

### How this works

Say we have a `GetUserCharacterApi` request:

```json
{
    "userId": 10000,
    "maxCount": 700,
    "nextIndex": 0
}
```

Instead of getting the entire character list from the database (which can be very large if the user force unlocked everything), add limit/offset to the query:

```python
select(character)
.where(character.c.user == user_id)
.order_by(character.c.id.asc())
.limit(max_count + 1)
.offset(next_index)
```

The query takes `maxCount + 1` items from the database to determine if there is more items than can be returned:

```python
rows = ...

if len(rows) > max_count:
    # return only max_count rows
    next_index += max_count
else:
    # return everything left
    next_index = -1
```

This has the benefit of not needing to load everything into memory (and also having to store server state, as seen in the [`SCORE_BUFFER` list](2274b42358/titles/chuni/base.py (L13)).)

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/185
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-11-16 19:10:29 +00:00
beerpsi
bc7524c8fc fix: make database async 2024-11-14 12:36:22 +07:00
daydensteve
c2d4abcc26 db and import updates for userbox, avatar, voice, and map icon 2024-11-03 16:37:05 -05:00
Kevin Trocolli
0cef797a8a mai2: rework photo uploads, relates to #67 2024-10-06 03:47:10 -04:00
ppc
f47175a144 [mai2] add buddies plus support (#177)
Adds favorite music support (there's an option in the results screen to star a song), handlers for new methods and fixes upsert failures for `userFavoriteList`.
The `UserIntimateApi` has been added but didn't seem to add any data during testing, and `CreateTokenApi`/`RemoveTokenApi` have also been added but I think they're only used during guest play.

---
Tested on 1.45 with no errors/game crashes (see logs). Card Maker hasn't been tested as I don't have a setup to play with.

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/177
Co-authored-by: ppc <albie@ppc.moe>
Co-committed-by: ppc <albie@ppc.moe>
2024-09-23 17:21:29 +00:00
Hay1tsme
c65c71e89e card: add memos 2024-07-06 23:13:41 -04:00
Kevin Trocolli
44fb6037cf chuni: add missing alembic script 2024-06-29 00:08:11 -04:00
Hay1tsme
4446ff1f21 mai2: add present support 2024-06-28 15:48:27 -04:00
Hay1tsme
7242a187ab sao: fix sao_hero_log_data nullability 2024-06-28 12:25:33 -04:00
Kevin Trocolli
601cec9075 sao: you already know what it is 2024-06-27 10:02:19 -04:00
Kevin Trocolli
177f851368 sao: cleanup 2024-06-27 00:07:10 -04:00
Kevin Trocolli
40a66614bc sao: fix user_hero_log_id 2024-06-27 00:04:23 -04:00
Kevin Trocolli
171131493f sao: fix new issues 2024-06-26 23:57:07 -04:00
Kevin Trocolli
c13b096190 sao: split massive upgrade in half and hope it works 2024-06-26 23:31:59 -04:00
Kevin Trocolli
5eb2ef8311 sao: schema fixes 3: the misery never ends 2024-06-26 23:01:47 -04:00
Kevin Trocolli
f27f789269 sao: alembic sucks sometimes. 2024-06-26 22:37:56 -04:00
Kevin Trocolli
7206af83cb sao: fix upgrade script 2024-06-26 22:30:12 -04:00
Kevin Trocolli
e91f84fecc sao: backport changes from diana 2024-06-25 14:02:53 -04:00
Hay1tsme
8f9e9d4766 fix downgrade script issue referenced in #156 2024-06-24 13:37:10 -04:00
Kevin Trocolli
3979a020a6 add idm and chip_id fields to card table 2024-06-22 00:47:12 -04:00
Kevin Trocolli
ca9ccbe8a3 chuni: add missing net battle funcs 2024-06-21 23:00:35 -04:00
beerpsi
5378655c52 [chunithm] Support LUMINOUS 2024-06-20 08:11:24 +07:00
Kevin Trocolli
00224585bb pokken: fix pokemon_data uk 2024-06-14 00:06:39 -04:00
Kevin Trocolli
f94d22ab0d mai2: add tables for rivals and favorite music 2024-06-08 19:04:27 -04:00
akanyan
df2a4d3074 ongeki: clearstatus db migration 2024-05-29 19:15:22 +09:00
Kevin Trocolli
a2fe83ae06 cxb: add grade to playlog 2024-05-28 22:32:38 -04:00
Kevin Trocolli
4ee4c26f5e allnet: enhance logging 2024-05-22 00:05:32 -04:00
Kevin Trocolli
a9587a9c91 add additional details to event_log 2024-05-21 23:05:22 -04:00
Dniel97
3613f4dbd2
mai2: BUDDiES support added 2024-03-20 21:42:38 +01:00
beerpsi
40a0817009 CHUNITHM & O.N.G.E.K.I.: Handle userRatingBase*List (#113)
These tables are not used by the game, but are useful for anyone wanting to develop a web UI showing what the player's rating consists of. As such, instead of storing them in JSON columns, I've split them out, one row per each entry.

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/113
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-03-14 14:44:32 +00:00
Hay1tsme
edd3ce8ead move to alembic 2024-01-09 13:57:59 -05:00
Kevin Trocolli
14fa0f5e8e begin move 2024-01-09 03:07:04 -05:00