@@ -36,8 +36,9 @@ div(style="font-size: 0.9em")
3636import ' vue-awesome/icons/circle' ;
3737import ' vue-awesome/icons/regular/plus-square' ;
3838import ' vue-awesome/icons/regular/minus-square' ;
39- const _ = require (' lodash' );
40- const classes = require (' ~/util/classes.ts' );
39+ import _ from ' lodash' ;
40+ import { build_category_hierarchy , flatten_category_hierarchy } from ' ../util/classes.ts' ;
41+ import { IEvent } from ' ../util/interfaces.ts' ;
4142
4243function _get_child_cats(cat , all_cats ) {
4344 return _ .filter (all_cats , c => _ .isEqual (c .parent , cat .name ));
@@ -75,16 +76,16 @@ export default {
7576 },
7677 category_hierarchy : function () {
7778 if (! this .events ) return [];
78- const events = JSON .parse (JSON .stringify (this .events ));
79+ const events: IEvent [] = JSON .parse (JSON .stringify (this .events )) as IEvent [] ;
7980
80- const hier = classes . build_category_hierarchy (
81+ const hier = build_category_hierarchy (
8182 _ .map (events , e => {
82- return { name: e .data [' $category' ] };
83+ return { name: e .data [' $category' ], rule: { type: ' none ' } };
8384 })
8485 );
8586
86- let cats = classes . flatten_category_hierarchy (hier ).map (c => {
87- c . duration = _ .sumBy (
87+ let cats = flatten_category_hierarchy (hier ).map (c => {
88+ c [ ' duration' ] = _ .sumBy (
8889 events .filter (e => {
8990 const pcat = e .data [' $category' ].slice (0 , c .name .length );
9091 return _ .isEqual (c .name , pcat );
@@ -96,7 +97,7 @@ export default {
9697
9798 const cats_with_depth0 = _ .sortBy (
9899 _ .filter (cats , c => c .depth == 0 ),
99- c => - c . duration
100+ c => - c [ ' duration' ]
100101 );
101102 _ .map (cats_with_depth0 , c => _assign_children (c , cats ));
102103
0 commit comments