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 }) => {
|
||||
const leftActivity = activity
|
||||
.filter(a => a.ch === "l")
|
||||
.map(a => a.endTime - a.startTime)
|
||||
.reduce((a, c) => a + c, 0);
|
||||
const rightActivity = activity
|
||||
.filter(a => a.ch === "r")
|
||||
const leftActivity = activity.filter(a => a.ch === "l"),
|
||||
rightActivity = activity.filter(a => a.ch === "r");
|
||||
const [l, r] = [leftActivity, rightActivity].map(activity => {
|
||||
return activity
|
||||
.map(a => a.endTime - a.startTime)
|
||||
.reduce((a, c) => a + c, 0);
|
||||
});
|
||||
const sum = l + r;
|
||||
|
||||
return (
|
||||
<dl>
|
||||
<dt>会話時間 (ms)</dt>
|
||||
<dd>{leftActivity + rightActivity}</dd>
|
||||
<dd>{sum}</dd>
|
||||
<dt>会話の割合</dt>
|
||||
<dd>
|
||||
左{" "}
|
||||
<meter value={leftActivity / (leftActivity + rightActivity)}>
|
||||
{leftActivity / (leftActivity + rightActivity)}
|
||||
</meter>{" "}
|
||||
右
|
||||
左 <meter value={l / sum}>{l / sum}</meter> 右
|
||||
</dd>
|
||||
</dl>
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue