-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #81 Convert StatisticsGeneratorConfig to a simple Kotlin data c…
…lass. Statistics generation is working locally.
- Loading branch information
1 parent
fb8395b
commit 4922d7d
Showing
6 changed files
with
149 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
kgstatsSrv/src/main/java/ru/klavogonki/statistics/export/StatisticsGeneratorConfig.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
kgstatsSrv/src/main/kotlin/ru/klavogonki/statistics/export/StatisticsGeneratorConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ru.klavogonki.statistics.export | ||
|
||
/** | ||
* Конфиг, настраивающий генерацию словарей. | ||
* | ||
* todo: по факту, в конфиг можно перенести настройки, которые сейчас реализуют классы, | ||
* реализующие [ru.klavogonki.statistics.export.vocabulary.VocabularyTopExporter]. | ||
*/ | ||
data class StatisticsGeneratorConfig( | ||
// aggregate tops | ||
val exportIndexPage: Boolean = false, | ||
|
||
val exportTopBySpeed: Boolean = false, // old exporter, not by normal vocabulary | ||
val exportTop500Pages: Boolean = false, | ||
val exportPlayersByRank: Boolean = false, | ||
|
||
// standard vocabularies | ||
val exportNormalTop: Boolean = false, | ||
val exportAbraTop: Boolean = false, | ||
val exportReferatsTop: Boolean = false, | ||
val exportNoErrorTop: Boolean = false, | ||
val exportMarathonTop: Boolean = false, | ||
val exportCharsTop: Boolean = false, | ||
val exportDigitsTop: Boolean = false, | ||
val exportSprintTop: Boolean = false, | ||
|
||
// non-standard vocabularies | ||
val exportNormalInEnglishTop: Boolean = false, | ||
val exportMiniMarathonTop: Boolean = false, | ||
val exportShortTextsTop: Boolean = false, | ||
val exportFrequencyVocabularyTop: Boolean = false, | ||
val exportOneHundredRussianTop: Boolean = false, | ||
val exportDigitsOneHundredTop: Boolean = false, | ||
val exportTrainingIndexFingersTop: Boolean = false, | ||
val exportRingFingersTop: Boolean = false, | ||
val exportPinkiesPlusTop: Boolean = false | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
echo "Arguments: <minPlayerId> <maxPlayerId> <threadsCount>" | ||
echo "" | ||
|
||
echo "Environment variables values: " | ||
echo "ROOT_WORKING_DIR: $ROOT_WORKING_DIR" | ||
echo "LOG4J_XML_FILE_PATH: $LOG4J_XML_FILE_PATH" | ||
echo "KGSTATS_SRV_JAR_FILE_PATH: $KGSTATS_SRV_JAR_FILE_PATH" | ||
echo "KGSTATS_SRV_SQL_DIR: $KGSTATS_SRV_SQL_DIR" | ||
echo "KGSTATS_WEB_ROOT_DIR: $KGSTATS_WEB_ROOT_DIR" | ||
echo "SPRING_CONFIG_LOCATION: $SPRING_CONFIG_LOCATION" | ||
echo "GENERATE_STATISTICS_CONFIG_LOCATION: $GENERATE_STATISTICS_CONFIG_LOCATION" | ||
echo "DATABASE_USER: $DATABASE_USER" | ||
echo "DATABASE_PASSWORD: $DATABASE_PASSWORD" | ||
echo "DATABASE_NAME: $DATABASE_NAME" | ||
echo "" | ||
|
||
# declare required variables | ||
# todo: set defaults, see https://stackoverflow.com/a/2013589/8534088 | ||
# todo: we should be able to override them from the command line | ||
#ROOT_WORKING_DIR=/d/kg/ | ||
|
||
#LOG4J_XML_FILE_PATH=log4j2.xml | ||
|
||
#KGSTATS_SRV_JAR_FILE_PATH=kgstatsSrv/target/kgstats-srv-1.0.jar | ||
# todo: maybe take kgstatsSrv statics from target? | ||
#KGSTATS_SRV_SQL_DIR=kgstatsSrv/src/main/resources/sql | ||
# todo: maybe take kgstatsWeb statics from target? | ||
#KGSTATS_WEB_ROOT_DIR=kgstatsWeb/src/main/webapp | ||
#SPRING_CONFIG_LOCATION=kgstatsSrv/src/main/resources/application.actions.properties | ||
|
||
#DATABASE_USER=root | ||
#DATABASE_PASSWORD=root | ||
#DATABASE_NAME=actions | ||
|
||
DATABASE_DUMP_FILE_NAME=database.sql | ||
DATABASE_DUMP_FILE_PATH=$ROOT_WORKING_DIR/$DATABASE_DUMP_FILE_NAME | ||
|
||
JSON_FILES_DIRECTORY_NAME=/json | ||
JSON_FILES_DIRECTORY_PATH=$ROOT_WORKING_DIR/$JSON_FILES_DIRECTORY_NAME | ||
|
||
INPUT_CONFIG_FILE_NAME=config.json | ||
INPUT_CONFIG_FILE_PATH=$ROOT_WORKING_DIR/$INPUT_CONFIG_FILE_NAME | ||
|
||
OUTPUT_CONFIG_FILE_NAME=config-output.json | ||
OUTPUT_CONFIG_FILE_PATH=$ROOT_WORKING_DIR/$OUTPUT_CONFIG_FILE_NAME | ||
|
||
GENERATE_STATISTICS_DIRECTORY_NAME=/stats | ||
GENERATE_STATISTICS_DIRECTORY_PATH=$ROOT_WORKING_DIR/$GENERATE_STATISTICS_DIRECTORY_NAME | ||
STATIC_DIR=$GENERATE_STATISTICS_DIRECTORY_PATH | ||
|
||
# zip files | ||
JSON_DATA_ZIP_FILE_NAME=json.zip | ||
STATISTICS_ZIP_FILE_NAME=statistics.zip | ||
DATABASE_DUMP_ZIP_FILE_NAME=database.zip | ||
|
||
# s3 buckets | ||
S3_BUCKET_TEST=klavostat-test | ||
S3_BUCKET_DATA=klavostat-data | ||
|
||
# create config json file from input arguments | ||
# todo: add input arguments validation, although it will already work in SpringBoot app | ||
MIN_PLAYER_ID=$1 | ||
MAX_PLAYER_ID=$2 | ||
THREADS_COUNT=$3 | ||
|
||
# copy static files from sources of kgstatsWeb to generated statistics | ||
cp -R $KGSTATS_WEB_ROOT_DIR/css $STATIC_DIR | ||
cp -R $KGSTATS_WEB_ROOT_DIR/img $STATIC_DIR | ||
|
||
# make sure /js is a directory | ||
mkdir -p "$STATIC_DIR/js" | ||
|
||
# make sure /xlsx is a directory | ||
mkdir -p "$STATIC_DIR/xlsx" | ||
|
||
# todo: after we exclude the generated files from sources, copy js recursively | ||
|
||
# cp -R $KGSTATS_WEB_ROOT_DIR/js $STATIC_DIR | ||
cp "$KGSTATS_WEB_ROOT_DIR/js/players-by-rank-chart.js" "$STATIC_DIR/js" | ||
cp "$KGSTATS_WEB_ROOT_DIR/js/stats-data.js" "$STATIC_DIR/js" | ||
cp "$KGSTATS_WEB_ROOT_DIR/js/stats-top-table.js" "$STATIC_DIR/js" | ||
|
||
# todo: old tops must be copied from archive S3 buckets, not from sources | ||
cp -R $KGSTATS_WEB_ROOT_DIR/2020-12-09 $STATIC_DIR | ||
|
||
echo "Copied static files from $KGSTATS_WEB_ROOT_DIR to $STATIC_DIR." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters