✨ feat(segment-analysis APIs): Added stored_source_raw_word_count prop#4616
Open
mauretto78 wants to merge 1 commit into
Open
✨ feat(segment-analysis APIs): Added stored_source_raw_word_count prop#4616mauretto78 wants to merge 1 commit into
stored_source_raw_word_count prop#4616mauretto78 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the segment-analysis API to expose a persisted (DB-stored) raw word count for the source segment (stored_source_raw_word_count), backed by selecting segments.raw_word_count in the underlying DAO queries.
Changes:
- Adds
stored_source_raw_word_countto the V3 segment-analysis API response payload. - Modifies
SegmentDaoanalysis queries to includes.raw_word_countin the SELECT list.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/Model/Segments/SegmentDao.php |
Updates SELECT columns for segment-analysis queries (currently introduces a duplicate column and one SQL syntax error). |
lib/Controller/API/V3/SegmentAnalysisController.php |
Adds stored_source_raw_word_count to the formatted API response (needs corresponding test assertion; PR metadata also appears mismatched). |
Comment on lines
931
to
935
| s.segment, | ||
| s.raw_word_count, | ||
| st.translation, | ||
| st.status, | ||
| s.raw_word_count, |
Comment on lines
1029
to
1033
| s.segment, | ||
| s.raw_word_count | ||
| st.translation, | ||
| st.status, | ||
| s.raw_word_count, |
Comment on lines
346
to
350
| 'target' => $segmentForAnalysis->translation, | ||
| 'source_lang' => $segmentForAnalysis->source, | ||
| 'target_lang' => $segmentForAnalysis->target, | ||
| 'stored_source_raw_word_count' => $segmentForAnalysis->raw_word_count, | ||
| 'source_raw_word_count' => CatUtils::segment_raw_word_count($segmentForAnalysis->segment, $segmentForAnalysis->source, $filter), |
Comment on lines
347
to
351
| 'source_lang' => $segmentForAnalysis->source, | ||
| 'target_lang' => $segmentForAnalysis->target, | ||
| 'stored_source_raw_word_count' => $segmentForAnalysis->raw_word_count, | ||
| 'source_raw_word_count' => CatUtils::segment_raw_word_count($segmentForAnalysis->segment, $segmentForAnalysis->source, $filter), | ||
| 'target_raw_word_count' => CatUtils::segment_raw_word_count($segmentForAnalysis->translation, $segmentForAnalysis->target, $filter), |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the correct hydration of
$projectStructure->sessionobject with the right GDrive key (Session::SESSION_KEY).Type
feat— new user-facing featureChanges
lib/Controller/API/V3/SegmentAnalysisController.phpstored_source_raw_word_countto API responselib/Model/Segments/SegmentDao.phps.raw_word_countto the SQL statementTesting
vendor/bin/phpunit --exclude-group=ExternalServices --no-coveragepassesAI Disclosure
GitHub Copilot (Claude)