feat(DayProduction, FalukantService, VocabLessonView): enhance vocabulary training and production tracking
All checks were successful
Deploy to production / deploy (push) Successful in 1m51s

- Added a new `completionCount` field to the DayProduction model to track the number of completed productions.
- Updated the FalukantService to aggregate completed productions using the new `completionCount` field, improving accuracy in production statistics.
- Introduced new vocabulary training features in VocabLessonView, including options to mark vocabulary as difficult and track remaining hard vocabulary, enhancing user engagement and learning effectiveness.
- Updated localization files for German and English to support new vocabulary training features, ensuring a consistent user experience across languages.
This commit is contained in:
Torsten Schulz (local)
2026-04-21 15:44:44 +02:00
parent 27d42c0a3a
commit 4cc2aace6b
5 changed files with 275 additions and 3 deletions

View File

@@ -23,7 +23,11 @@ DayProduction.init({
productionDate: {
type: DataTypes.DATEONLY,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_DATE')}
defaultValue: sequelize.literal('CURRENT_DATE')},
completionCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1}
}, {
sequelize,
modelName: 'DayProduction',

View File

@@ -2968,7 +2968,9 @@ class FalukantService extends BaseService {
/**
* Zertifikat: abgeschlossene Produktionen über alle Regionen/Niederlassungen.
* Es zählt jede abgeschlossene Produktion (ein Datensatz in falukant_log.production).
* Es zählt jede abgeschlossene Produktion.
* Seit Daemon-Migration über falukant_log.production.completion_count
* (aggregierte Zeilen => SUM(completion_count), nicht COUNT(*)).
* Filter bei gesetztem countSince wie Daemon (GET_PRODUCTION_CERTIFICATE_INPUT_ROWS):
* COALESCE(production_timestamp, production_date::timestamp) >= countSince.
*
@@ -2983,7 +2985,7 @@ class FalukantService extends BaseService {
if (countSince) replacements.countSince = countSince;
const rows = await sequelize.query(
`
SELECT COUNT(*)::int AS cnt
SELECT COALESCE(SUM(COALESCE(completion_count, 1)), 0)::int AS cnt
FROM falukant_log.production
WHERE producer_id = :producerId${sinceClause}
`,