mirror of
https://github.com/kou029w/_.git
synced 2025-01-30 22:08:02 +00:00
refactor: 実行プロセスを修正
This commit is contained in:
parent
9bea9c2e25
commit
0508d129c7
1 changed files with 10 additions and 14 deletions
|
@ -1,24 +1,20 @@
|
||||||
export default ({ activity }) => {
|
export default ({ activity }) => {
|
||||||
const leftActivity = activity
|
const leftActivity = activity.filter(a => a.ch === "l"),
|
||||||
.filter(a => a.ch === "l")
|
rightActivity = activity.filter(a => a.ch === "r");
|
||||||
.map(a => a.endTime - a.startTime)
|
const [l, r] = [leftActivity, rightActivity].map(activity => {
|
||||||
.reduce((a, c) => a + c, 0);
|
return activity
|
||||||
const rightActivity = activity
|
.map(a => a.endTime - a.startTime)
|
||||||
.filter(a => a.ch === "r")
|
.reduce((a, c) => a + c, 0);
|
||||||
.map(a => a.endTime - a.startTime)
|
});
|
||||||
.reduce((a, c) => a + c, 0);
|
const sum = l + r;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<dl>
|
<dl>
|
||||||
<dt>会話時間 (ms)</dt>
|
<dt>会話時間 (ms)</dt>
|
||||||
<dd>{leftActivity + rightActivity}</dd>
|
<dd>{sum}</dd>
|
||||||
<dt>会話の割合</dt>
|
<dt>会話の割合</dt>
|
||||||
<dd>
|
<dd>
|
||||||
左{" "}
|
左 <meter value={l / sum}>{l / sum}</meter> 右
|
||||||
<meter value={leftActivity / (leftActivity + rightActivity)}>
|
|
||||||
{leftActivity / (leftActivity + rightActivity)}
|
|
||||||
</meter>{" "}
|
|
||||||
右
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue