Commit Graph

39 Commits (58a5177a30dc8472c1f9cd60d6bb238b3c03c49e)

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
SoulGateKey 598e4aad76 Update mai2/schema/score.py to support new handle_get_game_ranking 2024-10-11 16:16:40 +00: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 e85728f33c chuni/mai2: remove upsert from put_playlog 2024-09-20 17:10:48 -04:00
Hay1tsme 9b5283d389 mai2: add event editing for sysops 2024-07-01 18:26:39 -04:00
Kevin Trocolli af8bd1d1c0 mai2: fix presents 2024-06-28 23:29:31 -04:00
Hay1tsme 4446ff1f21 mai2: add present support 2024-06-28 15:48:27 -04:00
Kevin Trocolli b4b8650acc mai2: add basic webui 2024-06-09 03:05:57 -04:00
Kevin Trocolli eccbd1ad81 mai2: add rivals support 2024-06-08 21:25:48 -04:00
Kevin Trocolli 123ec99a97 mai2: fix aggressive find and replace 2024-06-08 20:55:41 -04:00
Kevin Trocolli f94d22ab0d mai2: add tables for rivals and favorite music 2024-06-08 19:04:27 -04:00
Dniel97 3613f4dbd2
mai2: BUDDiES support added 2024-03-20 21:42:38 +01:00
Hay1tsme 05586df08a move to async database 2024-01-09 14:42:17 -05:00
Kevin Trocolli ad61bb3d9b mai2: fis issue with saving and loading charges 2023-11-24 10:36:46 -05:00
Dniel97 862907b82a
mai2: Fixed cards not showing up 2023-10-16 21:36:26 +02:00
Dniel97 d6e4db48f4
Added maimai DX FESTiVAL PLUS support
- Added Card Maker support for FESTiVAL PLUS
- Bumped SDEZ database to version 8
- Updated docs for FESTiVAL PLUS
2023-10-15 19:04:15 +02:00
Hay1tsme 88a1462304 logger: change from warn to warning 2023-08-08 10:17:56 -04:00
Kevin Trocolli f279adb894 mai2: add consecutive day login count, update db to v7, fix reader, courses, and docs 2023-07-01 21:51:18 -04:00
Kevin Trocolli 3e9cec3a20 mai2: put_recent_rating final fix 2023-07-01 02:11:37 -04:00
Kevin Trocolli 8f9584c3d2 mai2: hotfix put_recent_rating 2023-07-01 02:07:19 -04:00
Kevin Trocolli b29cb0fbaa mai2: fix put_recent_rating 2023-07-01 02:06:00 -04:00
Kevin Trocolli d9a92f5865 mai2: 4th round of fixes 2023-07-01 02:04:30 -04:00
Kevin Trocolli d89eb61e62 mai2: fixes round 3 2023-07-01 01:56:52 -04:00
Kevin Trocolli 2c6902a546 mai2: fix typos 2023-07-01 01:12:15 -04:00
Kevin Trocolli 318b73dd57 finale: finish porting request data from aqua 2023-07-01 01:08:54 -04:00
Kevin Trocolli 127e6f8aa8 mai2: add finale databases 2023-06-27 00:32:35 -04:00
Kevin Trocolli 5ca16f2067 mai2: fix GetUserMusicApi pagination 2023-06-13 22:07:48 -04:00
Dniel97 ad820ed091
cm: Added individual Card Maker version and maimai DX passes working 2023-05-30 12:14:18 +02:00
Kevin Trocolli 238d437519 reformat with black in preperation for merge to master 2023-04-23 21:04:52 -04:00
Midorica 017ef1e224 Merge pull request 'maimai DX FESTiVAL support' (#17) from Dniel97/artemis:maimai_dx_festival into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/17
2023-04-19 18:13:31 +00:00
Hay1tsme 15433b681c mai2: fix logging in put_card 2023-04-19 11:26:33 -04:00
Dniel97 28c06335b6
mai2: added upsert returns, fixed event reader, thanks @One3
Thanks to @One3 for helping with the events
2023-04-11 17:57:21 +02:00
Dniel97 f63dd07937
maimai: Initial Festival support 2023-04-10 19:11:58 +02:00
Dniel97 2af7751504 Added support for maimai and Chunithm in Card Maker 1.34/1.35 (#14)
Co-authored-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe>
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/14
Co-authored-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
Co-committed-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
2023-03-15 20:03:22 +00:00
Hay1tsme a76bb94eb1 let black do it's magic 2023-03-09 11:38:58 -05:00
Hay1tsme 1f2d12f318 maidx: upgrade schema for uni+ 2023-02-27 11:55:51 -05:00
Hay1tsme 806dd717e6 maidx: fix score, playlog and courses not saving properly 2023-02-27 11:39:42 -05:00
Hay1tsme 7e3396a7ff add back games, conform them to new title dispatch 2023-02-17 01:02:21 -05:00