Commit 9c6766a4 authored by l2m2's avatar l2m2

upload

parent 61b960f8
...@@ -2,13 +2,18 @@ var _ = require("lodash"); ...@@ -2,13 +2,18 @@ var _ = require("lodash");
var analysis_state_data = [ var analysis_state_data = [
{ "start_time": "2020-05-12 12:58:29", "end_time": "2020-05-12 13:02:06"}, { "start_time": "2020-05-12 12:58:29", "end_time": "2020-05-12 13:02:06"},
{ "start_time": "2020-05-12 13:02:06", "end_time": "2020-05-12 13:08:08"}, // { "start_time": "2020-05-12 13:02:06", "end_time": "2020-05-12 13:08:08"},
{ "start_time": "2020-05-12 13:08:08", "end_time": "2020-05-12 13:08:21"}, // { "start_time": "2020-05-12 13:08:08", "end_time": "2020-05-12 13:08:21"},
{ "start_time": "2020-05-12 13:08:08", "end_time": "2020-05-12 13:08:26"}, // { "start_time": "2020-05-12 13:08:08", "end_time": "2020-05-12 13:08:26"},
{ "start_time": "2020-05-12 13:08:21", "end_time": "2020-05-12 13:08:57"}, // { "start_time": "2020-05-12 13:08:21", "end_time": "2020-05-12 13:08:57"},
{ "start_time": "2020-05-12 13:09:43", "end_time": "2020-05-12 13:10:10"} // { "start_time": "2020-05-12 13:09:43", "end_time": "2020-05-12 13:10:10"}
]; ];
var dirty_index = _.findIndex( analysis_state_data, {start_time :_.last(analysis_state_data).start_time } );
print(dirty_index);
analysis_state_data = _.slice(analysis_state_data, 0, dirty_index);
print(JSON.stringify(analysis_state_data, null, ' '));
analysis_state_data = _.reduce(analysis_state_data, function(prev, curr, index){ analysis_state_data = _.reduce(analysis_state_data, function(prev, curr, index){
if (prev.length > 0) { if (prev.length > 0) {
if (curr.start_time == prev[prev.length - 1].start_time) { if (curr.start_time == prev[prev.length - 1].start_time) {
...@@ -22,4 +27,6 @@ analysis_state_data = _.reduce(analysis_state_data, function(prev, curr, index){ ...@@ -22,4 +27,6 @@ analysis_state_data = _.reduce(analysis_state_data, function(prev, curr, index){
return prev; return prev;
}, []); }, []);
print(JSON.stringify(analysis_state_data, null, ' ')); print(JSON.stringify(analysis_state_data, null, ' '));
\ No newline at end of file
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