Skip to content

✨ feat(segment-analysis APIs): Added stored_source_raw_word_count prop#4616

Open
mauretto78 wants to merge 1 commit into
developfrom
added-raw_word_count-to-segment-analysis-api
Open

✨ feat(segment-analysis APIs): Added stored_source_raw_word_count prop#4616
mauretto78 wants to merge 1 commit into
developfrom
added-raw_word_count-to-segment-analysis-api

Conversation

@mauretto78

@mauretto78 mauretto78 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the correct hydration of $projectStructure->session object with the right GDrive key (Session::SESSION_KEY).

Type

  • feat — new user-facing feature

Changes

File Change
lib/Controller/API/V3/SegmentAnalysisController.php Added stored_source_raw_word_count to API response
lib/Model/Segments/SegmentDao.php Added s.raw_word_count to the SQL statement

Testing

  • vendor/bin/phpunit --exclude-group=ExternalServices --no-coverage passes

AI Disclosure

  • AI tools were used — name the agent/tool below

GitHub Copilot (Claude)


Copilot AI review requested due to automatic review settings June 9, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_count to the V3 segment-analysis API response payload.
  • Modifies SegmentDao analysis queries to include s.raw_word_count in 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),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants