@@ -157,8 +157,31 @@ pub fn process_nested_tally(event: &FeedbackEvent) -> Vec<FeedbackEventNormalise
157157}
158158
159159pub fn process_associative ( event : & FeedbackEvent ) -> Vec < FeedbackEventNormalised > {
160- println ! ( "Received associative value, ignoring. Associative events will need a more manual approach. {:?}" , event. key_name) ;
161- vec ! [ ]
160+ let mut normalised_events = vec ! [ ] ;
161+
162+ match event. key_name . as_str ( ) {
163+ "time_dilation_current" =>
164+ for ( key, value) in event. json [ "data" ] . as_object ( ) . unwrap ( ) {
165+ for ( time_dilation_current, time_dilation_values) in value. as_object ( ) . unwrap ( ) {
166+ let time_dilation_current = NaiveDateTime :: parse_from_str ( time_dilation_current, "%Y-%m-%d %H:%M:%S" ) . unwrap ( ) ;
167+
168+ for ( time_dilation_average, time_dilation_value) in time_dilation_values. as_object ( ) . unwrap ( ) {
169+ normalised_events. push ( FeedbackEventNormalised {
170+ datetime : time_dilation_current,
171+ round_id : event. round_id ,
172+ category_primary : event. key_name . clone ( ) ,
173+ category_secondary : time_dilation_average. to_string ( ) ,
174+ category_tertiary : "" . to_string ( ) ,
175+ version : event. version ,
176+ value : time_dilation_value. to_string ( ) ,
177+ } ) ;
178+ }
179+ }
180+ } ,
181+ _ => println ! ( "Received associative value, ignoring. Associative events will need a more manual approach. {:?}" , event. key_name)
182+ }
183+
184+ normalised_events
162185}
163186
164187pub fn process_text ( event : & FeedbackEvent ) -> Vec < FeedbackEventNormalised > {
0 commit comments