1
0
mirror of synced 2025-02-15 18:02:39 +01:00

567 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
Hay1tsme
cb009f6e23 wacca: tiny cleanup 2024-11-14 12:39:21 -05:00
Hay1tsme
1331d473c9 Merge pull request '[mai2] Implement GetGameRankingAPI . Fix photo merge , Add UserScoreRankingAPI handler' (#181) from SoulGateKey/artemis:develop into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/181
2024-11-13 05:37:00 +00:00
SoulGateKey
f4dff9b4c1 fix: mai2 photos cant be merged 2024-11-11 21:16:19 +08:00
SoulGateKey
8a6250bebd Formatted log print
Change log level
2024-11-11 21:11:33 +08:00
daydensteve
eb18ad22b8 hardened ui against the db not being upgraded or importer not being ran 2024-11-08 09:17:12 -05:00
daydensteve
954bd565d3 reduced db access with new chuni webui customizations 2024-11-07 20:28:28 -05:00
SoulGateKey
f272e97eae Formatted log print
Change log level
2024-11-06 02:44:07 +08:00
SoulGateKey
aa7ae6cb51 Formatted log print 2024-11-06 02:38:18 +08:00
daydensteve
3a44b18d91 fixed erroneously wide trophy select 2024-11-03 19:27:20 -05:00
daydensteve
f5205801a8 Added customization unlock overrides 2024-11-03 19:12:49 -05:00
daydensteve
626ce6bd96 userbox, avatar, mapicon, and voice ui configuration 2024-11-03 18:37:09 -05:00
daydensteve
e49c70b738 more enums! 2024-11-03 16:37:27 -05:00
daydensteve
c2d4abcc26 db and import updates for userbox, avatar, voice, and map icon 2024-11-03 16:37:05 -05:00
daydensteve
2f6974cab6 new chuni ui images/directories 2024-11-03 08:48:13 -05:00
SoulGateKey
221517e310 TODO: GetUserScoreRankingApi 2024-10-30 12:37:18 +08:00
SoulGateKey
598e4aad76 Update mai2/schema/score.py to support new handle_get_game_ranking 2024-10-11 16:16:40 +00:00
SoulGateKey
a673d9dabd Delete unused dependency 2024-10-11 16:12:53 +00:00
SoulGateKey
398fa9059d Update mai2/base.py using the ORM 2024-10-11 16:09:53 +00:00
SoulGateKey
29f4a6a696 revert 033c1aa776b7874b6e534efd664f0b7010271e68
revert Update 卖
2024-10-11 16:08:15 +00:00
SoulGateKey
033c1aa776 Update 卖 2024-10-11 16:06:17 +00:00
SoulGateKey
bbf41ac83f Merge branch 'develop' into mai2_handle_get_game_ranking 2024-10-11 15:56:05 +00:00
Kevin Trocolli
451754cf3c sao: fix my store 2024-10-06 16:09:09 -04:00
Kevin Trocolli
0cef797a8a mai2: rework photo uploads, relates to #67 2024-10-06 03:47:10 -04:00
SoulGateKey
3843ac6eb1 mai2: calc GetGameRanking result 2024-10-03 19:32:17 +00:00
daydensteve
ed5e7dc561 [chuni] Added truncation to long Title and Artist Name values on import (#178)
I noticed the importer failing to import music 523 (Niji-iro no Flügel) from an omni pack due to the artist name being crazy long.

To address this, I added truncation to max column value length for both the Title and Artist Name values. Considered doing this for the other 3 string fields as well but I can't imagine those ever being problematic.

Import now succeeds with a warning generated about the truncation occurring

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/178
Co-authored-by: daydensteve <daydensteve@gmail.com>
Co-committed-by: daydensteve <daydensteve@gmail.com>
2024-09-25 15:21:30 +00:00
daydensteve
b04840f3dd [chuni] Frontend favorites support (#176)
I had been itching for the favorites feature since I'm bad with japanese so figured I'd go ahead and add it. I've included a few pics to help visualize the changes.

### Summary of user-facing changes:
- New Favorites frontend page that itemizes favorites by genre for the current version (as selected on the Profile page). Favorites can be removed from this page via the Remove button
- Updated the Records page so that it only shows the playlog for the currently selected version and includes a "star" to the left of each title that can be clicked to add/remove favorites. When the star is yellow, its a favorite; when its a grey outline, its not. I figure its pretty straight forward
- The Records and new Favorites pages show the jacket image of each song now (The Importer was updated to convert the DDS files to PNGs on import)

### Behind-the-scenes changes:
- Fixed a bug in the chuni get_song method - it was inappropriately comparing the row id instead of the musicid (note this method was not used prior to adding favorites support)
- Overhauled the score scheme file to stop with all the hacky romVersion determination that was going on in various methods. To do this, I created a new ChuniRomVersion class that is populated with all base rom versions, then used to derive the internal integer version  number from the string stored in the DB. As written, this functionality can infer recorded rom versions when the playlog was entered using an update to the base version (e.g. 2.16  vs 2.15 for sunplus or 2.22 vs 2.20 for luminous).
- Made the chuni config version class safer as it would previously throw an exception if you gave it a version not present in the config file. This was done in support of the score overhaul to build up the initial ChuniRomVersion dict
- Added necessary methods to query/update the favorites table.

### Testing
- Frontend testing was performed with playlog data for both sunplus (2.16) and luminous (2.22) present. All add/remove permutations and images behavior was as expected
- Game testing was performed only with Luminous (2.22) and worked fine

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/176
Co-authored-by: daydensteve <daydensteve@gmail.com>
Co-committed-by: daydensteve <daydensteve@gmail.com>
2024-09-25 14:53:43 +00:00
Hay1tsme
045465ed4e idz: disabled by default to silence warnings for people who don't feel like configuring games they don't intend to use 2024-09-23 14:46:41 -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
EmmyHeart
82004cb743 Fix map overload in Chusan 2024-09-14 01:30:29 +00:00
EmmyHeart
8f4c08f825 Fix map overload in Chusan 2024-09-14 01:28:35 +00:00
Hay1tsme
7ebd9bfb8a Merge pull request '[chuni] Auto stock tickets at login' (#170) from daydensteve/artemis:chuni_ticket_stock into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/170
2024-09-13 18:12:32 +00:00
Hay1tsme
944b80129b chuni: fix ultimate/worlds end chart reading, closes #63 2024-09-05 11:45:22 -04:00
Hay1tsme
73dda06413 mai2: add warning about portrait uploading not being supported. #67 2024-09-05 11:37:52 -04:00
daydensteve
eacd4a2f43 Adding stock_tickets and stock_count chuni mods. Enables specified tickets to be auto-stocked on login 2024-09-02 20:00:59 -04:00
Kevin Trocolli
c12272feab ...again 2024-08-11 02:11:23 -04:00
Kevin Trocolli
2a8a4880c2 Diva: change frontend nav name 2024-08-11 02:11:16 -04:00
Hay1tsme
b5715b8da6 Merge pull request 'chuni: fix encryption , added known iter keys , and add c2c api for sdgs' (#165) from Puz/artemis:develop into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/165
2024-07-15 18:32:55 +00:00
Mr Arythmia
39e89d4908 Add song ranks, improve non-S rating calculation 2024-07-15 03:40:56 +02:00
Puz
ec7605eeb0 chuni: added missing c2c endpoint for sdgs 2024-07-10 07:21:56 +00:00
Puz
b5e7a59b5f chuni: fix encryption , and added all known iter keys 2024-07-10 07:17:12 +00:00
ThatzOkay
58bdeb9290 Merge branch 'develop' into diva_configire_festa 2024-07-05 08:07:10 +00:00
Hay1tsme
9b5283d389 mai2: add event editing for sysops 2024-07-01 18:26:39 -04:00
=
97e1d5da05 fix disable. Fix casing in options 2024-06-30 12:54:44 +02:00
=
eb275062a1 Merge branch 'develop' into diva_configire_festa 2024-06-30 12:26:53 +02:00
=
e0e63a9a13 configurable festa options 2024-06-30 00:23:10 +02:00
Kevin Trocolli
44fb6037cf chuni: add missing alembic script 2024-06-29 00:08:11 -04:00
Hay1tsme
b2bd73a8f5 Merge branch 'develop' into develop 2024-06-29 04:03:14 +00:00
Kevin Trocolli
ecb2e9ec75 mai2: properly add present items 2024-06-28 23:55:23 -04:00