Commit 23555a5e authored by Sheng-Hao Tsao's avatar Sheng-Hao Tsao Committed by Commit Bot

Replace empty strings with "n/a" in metrics

This CL fixes the bug where data studio filters out empty strings and
make us unable to draw pie chart effectively.

Bug: 969647
Test: Capture some photos
Change-Id: Ie8714b0709a5d040408905df3bb4c62459fd8b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1640933
Commit-Queue: Sheng-hao Tsao <shenghao@chromium.org>
Reviewed-by: default avatarWei Lee <wtlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666184}
parent 5fd06394
......@@ -101,11 +101,15 @@ cca.metrics.launchType_ = function(ackMigrate) {
* @private
*/
cca.metrics.captureType_ = function(facingMode, length, [width, height]) {
var condState = (states, cond) => {
var condState = (states, cond, strict) => {
// Return the first existing state among the given states only if there is
// no gate condition or the condition is met.
const prerequisite = !cond || cca.state.get(cond);
return prerequisite && states.find((state) => cca.state.get(state)) || '';
if (strict && !prerequisite) {
return '';
}
return prerequisite && states.find((state) => cca.state.get(state)) ||
'n/a';
};
return cca.metrics.base_.category('capture')
......@@ -116,7 +120,7 @@ cca.metrics.captureType_ = function(facingMode, length, [width, height]) {
.dimen(4, condState(['mirror']))
.dimen(5, condState(['_3x3', '_4x4', 'golden'], 'grid'))
.dimen(6, condState(['_3sec', '_10sec'], 'timer'))
.dimen(7, condState(['mic'], 'video-mode'))
.dimen(7, condState(['mic'], 'video-mode', true))
.dimen(8, condState(['max-wnd']))
.dimen(9, condState(['tall']))
.dimen(10, `${width}x${height}`)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment