Skip to content

Commit fc8b9d0

Browse files
fixed manual data load events not populating
1 parent 42219e4 commit fc8b9d0

4 files changed

Lines changed: 18 additions & 9 deletions

File tree

app.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name,type,data,title_col,filter_cols,date,show_cols,drawing_info,legend
2-
pens,geojson,data/-Farm AL_8.29.25.geojson,id,,,id," {
2+
pens,geojson,data/Farm AL_8.29.25.geojson,id,,,id," {
33
""renderer"": {
44
""type"": ""simple"",
55
""symbol"": {
@@ -41,7 +41,7 @@ pens,geojson,data/-Farm AL_8.29.25.geojson,id,,,id," {
4141
]
4242
}
4343
]}"
44-
movement,csv,data/-Farm AL Centroid Data Cleaned 9.9.25.csv,ID,,DATE,," {
44+
movement,csv,data/farm al. partial raw data.csv,ID,,DATE,," {
4545
""renderer"": {
4646
""type"": ""simple"",
4747
""symbol"": {

css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ font-size: 18px;
1818
#map_wrapper{
1919
float:left;
2020
color: #9c27b0;
21-
height: 500px;
21+
height: 700px;
2222
width: 100%;
2323
}
2424

js/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ function setup_interface(_event_settings){
193193
// set event label
194194
event_data[obj.label]=[]
195195
// create buckets with all the config specified events to be tracked
196-
record_manager.populate_days(event_data[obj.label],obj.start,obj.end,end_date)
196+
if(obj.end){
197+
obj.end= obj.end.trim()
198+
}
199+
record_manager.populate_days(event_data[obj.label],obj.start.trim(),obj.end,end_date)
197200

198201
}
199202
load_data("images/cow.svg","",populate_legend)
@@ -212,6 +215,9 @@ function setup_interface(_event_settings){
212215
console.log("unable to zoom the map")
213216

214217
}
218+
//
219+
console.log(event_data)
220+
215221
}else{
216222
record_manager.search_by_date(moment.unix($("#filter_date .filter_slider_box").slider("values")[0]).utc())
217223
}

js/record_manager.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ class Record_Manager {
137137
}
138138
//artificially populate the CURRENT PEN value - we want to know where the cow moved from
139139
if($("#CURRENT_PEN").val()==0){
140-
for(var i=this.json_data.length;i>0;i--){
140+
console.log("Artificially populate the CURRENT PEN")
141+
for(var i=1;i<this.json_data.length;i++){
141142
// populate the "CURRENT PEN" value with the previous record matching the cow id
142-
for(var j=i-1;j>this.json_data.length;j--){
143+
for(var j=i-1;j>0;j--){
143144
if(this.json_data[i]["ID"]==this.json_data[j]["ID"]){
144145
this.json_data[i]["CURRENT PEN"]= this.json_data[j]["TO PEN"]
145146
break
@@ -148,8 +149,8 @@ class Record_Manager {
148149
}
149150
}
150151
$("#model_data_config").hide()
151-
record_manager.process_data(record_manager.json_data,record_manager);
152152

153+
record_manager.process_data(record_manager.json_data,record_manager);
153154

154155
}
155156

@@ -384,17 +385,19 @@ class Record_Manager {
384385
// called with event_data["sick"],"FLU","WELL",end_date)
385386
// create a sub set of the data
386387
//any record that has an EVENT labeled {_event_start} should have a record
387-
//console.log("populate_days", _end_date)
388+
//console.log("populate_days", _end_date,_array)
388389
for(var i=0;i<this.json_data.length;i++){
389390
var t = this.json_data[i];
391+
390392
var end_date = false
391393
if(t["EVENT"].trim()==_event_start){
392394

393395
// find the end date which should be ahead
394396
if(_event_end && _event_end!=""){
395397
for(var j=i+1;j<this.json_data.length;j++){
396398
var u = this.json_data[j]
397-
// make sure the next event is later than the first and matched the desired end event name
399+
// make sure the next event is later than the first and matches the desired end event name
400+
398401
if(u["ID"]==t["ID"] && u["EVENT"].trim()==_event_end && moment(t["START DATE"],this.date_format).unix() < moment(u["START DATE"],this.date_format).unix()){
399402
// console.log("Closing t",t, "with u",u)
400403
end_date=moment(u["START DATE"],this.date_format).unix()

0 commit comments

Comments
 (0)