Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
fetus-hina committed Nov 15, 2023
2 parents b9ec935 + 2c12a9d commit 9659e87
Show file tree
Hide file tree
Showing 22 changed files with 227 additions and 39 deletions.
14 changes: 12 additions & 2 deletions commands/stat/actions/XPowerDistrib3Action.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* @copyright Copyright (C) 2015-2022 AIZAWA Hina
* @copyright Copyright (C) 2015-2023 AIZAWA Hina
* @license https://github.com/fetus-hina/stat.ink/blob/master/LICENSE MIT
* @author AIZAWA Hina <hina@fetus.jp>
*/
Expand Down Expand Up @@ -197,14 +197,24 @@ private function updateDistrib(Connection $db): bool

private function updateDistribAbstract(Connection $db): bool
{
$percentile = fn (float $p): string => sprintf(
'PERCENTILE_CONT(%.2f) WITHIN GROUP (ORDER BY {{t}}.[[x_power]] ASC)',
$p,
);

$select = (new Query())
->select([
'season_id' => '{{t}}.[[season_id]]',
'rule_id' => '{{t}}.[[rule_id]]',
'users' => 'COUNT(*)',
'average' => 'AVG({{t}}.[[x_power]])',
'stddev' => 'STDDEV_SAMP({{t}}.[[x_power]])',
'median' => 'PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY {{t}}.[[x_power]] ASC)',
'median' => $percentile(0.5),
'pct5' => $percentile(0.05),
'pct25' => $percentile(0.25),
'pct75' => $percentile(0.75),
'pct80' => $percentile(0.80),
'pct95' => $percentile(0.95),
])
->from(['t' => self::TMP_USER_XPOWER_TABLE_NAME])
->groupBy(['season_id', 'rule_id']);
Expand Down
1 change: 1 addition & 0 deletions components/widgets/Budoux.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace app\components\widgets;

use Yii;
use app\assets\budoux\BudouxWebComponentsJaAsset;
use app\assets\budoux\BudouxWebComponentsZhHansAsset;
use app\assets\budoux\BudouxWebComponentsZhHantAsset;
Expand Down
2 changes: 2 additions & 0 deletions messages/de/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -626,6 +627,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/en-GB/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -627,6 +628,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => 'This data was totalled after normalisation to 5 minute intervals for each battle.',
Expand Down
2 changes: 2 additions & 0 deletions messages/es-MX/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -628,6 +629,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'Estas batallas fueron registradas con una versión de IkaLog. Actualice a la versión más reciente.',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'Esta batalla fue grabada con una versión de IkaLog. Actualice a la versión más reciente.',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/es/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => 'Clave de amigo',
Expand Down Expand Up @@ -628,6 +629,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'Estas batallas fueron registradas con una versión de IkaLog. Actualice a la versión más reciente.',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'Esta batalla fue grabada con una versión de IkaLog. Actualice a la versión más reciente.',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/fr-CA/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -626,6 +627,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/fr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
'Filter' => 'Filtre',
'Filter Query' => 'Requête de Filtre',
'Final Count' => 'Progression Finale',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => 'pour {title}',
'Freshness' => 'Titre d\'arme',
'Friend Code' => 'Code ami',
Expand Down Expand Up @@ -629,6 +630,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'Ces matchs ont été enregistrés avec une version obsolète d\'IkaLog. Veuillez mettre l\'application à jour.',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'Ce match a été enregistré avec une version obsolète d\'IkaLog. Veuillez mettre l\'application à jour.',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => 'Ces données viennent de la base d\'utilisateurs de {siteName} et ne correspondent pas aux statistiques globales du jeu.',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => 'Ces données ont été totalisées après une normalisation de chaque match à 5 minutes d\'intervalle chacun.',
Expand Down
2 changes: 2 additions & 0 deletions messages/it/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -626,6 +627,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/ja/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
'Filter Query' => 'フィルタクエリ',
'Filter' => 'フィルタ',
'Final Count' => '最終カウント',
'For the actual distribution, see the charts for each mode.' => '実際の分布は各ルールのグラフを参照してください。',
'Freshness' => 'チョーシ',
'Friend Code (Switch)' => 'フレンドコード (Switch)',
'Friend Code' => 'フレンドコード',
Expand Down Expand Up @@ -616,6 +617,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '古いIkaLogで記録されました。情報が正しく解析されないため、最新のIkaLogへアップデートしてください。',
'This Month (UTC)' => '今月(ガチマ集計期間)',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => 'このバトルは古いIkaLogで記録されました。情報が正しく解析されないため、最新のIkaLogへアップデートしてください。',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => 'このグラフは、各ルールを比較しやすくするために、パワーの単純な正規分布を仮定しています。',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => 'このデータは{siteName}の利用者を集計したもので、ゲーム全体の統計とは大きく異なります。',
'This data is basically not informative.' => 'このデータは基本的には参考になりません。',
'This data was totaled after normalization to 5 minute intervals for each battle.' => 'データは5分間に正規化して集計しています。',
Expand Down
2 changes: 2 additions & 0 deletions messages/ko/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
'Filter' => '필터',
'Filter Query' => '필터 쿼리',
'Final Count' => '최종 카운트',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '컨디션',
'Friend Code' => '친구 코드',
Expand Down Expand Up @@ -628,6 +629,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '해당 배틀들은 구버전 IkaLog로 기록됐습니다. 최신 버전으로 업데이트 바랍니다.',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '해당 배틀은 구버전 IkaLog로 기록됐습니다. 최신 버전으로 업데이트 바랍니다.',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '이 데이터는 {siteName} 유저들 기반이고 게임 전체 통계와는 큰 차이가 있습니다.',
'This data is basically not informative.' => '기본적으로 이 데이터는 유용하지 않습니다.',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/nl/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -626,6 +627,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/ru/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
'Filter' => '',
'Filter Query' => '',
'Final Count' => '',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '',
'Freshness' => '',
'Friend Code' => '',
Expand Down Expand Up @@ -626,6 +627,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '',
Expand Down
2 changes: 2 additions & 0 deletions messages/zh-CN/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
'Filter' => '筛选器',
'Filter Query' => '筛选标准',
'Final Count' => '最终计数',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '该称号 {title}',
'Freshness' => '新鲜度',
'Friend Code' => '好友码',
Expand Down Expand Up @@ -629,6 +630,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '这些对战是由旧版的IkaLog记录。 请更新到最新版本。',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '该对战是由旧版的IkaLog记录。请更新到最新版本。',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '',
'This data is basically not informative.' => '',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '该数据是根据每场对战五分钟的间隔做归一化处理后汇总的。',
Expand Down
2 changes: 2 additions & 0 deletions messages/zh-TW/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@
'Filter' => '篩選器',
'Filter Query' => '篩選標準',
'Final Count' => '最終計數',
'For the actual distribution, see the charts for each mode.' => '',
'for {title}' => '該稱號 {title}',
'Freshness' => '新鮮度',
'Friend Code' => '好友代碼',
Expand Down Expand Up @@ -628,6 +629,7 @@
'These battles were recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '這些對戰是由舊版的IkaLog記錄。 請更新到最新版本。',
'The width of the histogram bins is automatically adjusted by Scott\'s rule-based algorithm.' => '',
'This battle was recorded with an outdated version of IkaLog. Please upgrade to the latest version.' => '該對戰是由舊版的IkaLog記錄。請更新到最新版本。',
'This chart assumes simple normal distribution of the Power to make it easier to compare each mode.' => '',
'This data is based on {siteName} users and differs significantly from overall game statistics.' => '此資料僅基於 {siteName} 用戶,與整體遊戲的統計數據會有相當大的差異',
'This data is basically not informative.' => '這個資料基本上沒有訊息',
'This data was totaled after normalization to 5 minute intervals for each battle.' => '該資料的彙整是根據每場對戰五分鐘的間隔來做正規化處理。',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* @copyright Copyright (C) 2015-2023 AIZAWA Hina
* @license https://github.com/fetus-hina/stat.ink/blob/master/LICENSE MIT
* @author AIZAWA Hina <hina@fetus.jp>
*/

declare(strict_types=1);

use app\components\db\Migration;

final class m231115_085522_stat_x_power_distrib_abstract3_percentile extends Migration
{
/**
* @inheritdoc
*/
public function safeUp()
{
$this->addColumns('{{%stat_x_power_distrib_abstract3}}', [
'pct5' => $this->decimal(6, 1)->null(),
'pct25' => $this->decimal(6, 1)->null(),
'pct75' => $this->decimal(6, 1)->null(),
'pct80' => $this->decimal(6, 1)->null(),
'pct95' => $this->decimal(6, 1)->null(),
]);

return true;
}

/**
* @inheritdoc
*/
public function safeDown()
{
$this->dropColumns('{{%stat_x_power_distrib_abstract3}}', [
'pct5',
'pct25',
'pct75',
'pct80',
'pct95',
]);

return true;
}

/**
* @inheritdoc
*/
protected function vacuumTables(): array
{
return [
'{{%stat_x_power_distrib_abstract3}}',
];
}
}
12 changes: 11 additions & 1 deletion models/StatXPowerDistribAbstract3.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* @property double $average
* @property double $stddev
* @property string $median
* @property string $pct5
* @property string $pct25
* @property string $pct75
* @property string $pct80
* @property string $pct95
*
* @property Rule3 $rule
* @property Season3 $season
Expand All @@ -39,7 +44,7 @@ public function rules()
[['season_id', 'rule_id', 'users', 'average'], 'required'],
[['season_id', 'rule_id', 'users'], 'default', 'value' => null],
[['season_id', 'rule_id', 'users'], 'integer'],
[['average', 'stddev', 'median'], 'number'],
[['average', 'stddev', 'median', 'pct5', 'pct25', 'pct75', 'pct80', 'pct95'], 'number'],
[['season_id', 'rule_id'], 'unique', 'targetAttribute' => ['season_id', 'rule_id']],
[['rule_id'], 'exist', 'skipOnError' => true, 'targetClass' => Rule3::class, 'targetAttribute' => ['rule_id' => 'id']],
[['season_id'], 'exist', 'skipOnError' => true, 'targetClass' => Season3::class, 'targetAttribute' => ['season_id' => 'id']],
Expand All @@ -55,6 +60,11 @@ public function attributeLabels()
'average' => 'Average',
'stddev' => 'Stddev',
'median' => 'Median',
'pct5' => 'Pct5',
'pct25' => 'Pct25',
'pct75' => 'Pct75',
'pct80' => 'Pct80',
'pct95' => 'Pct95',
];
}

Expand Down
Loading

0 comments on commit 9659e87

Please sign in to comment.