Skip to content

Commit

Permalink
Merge branch '2024-refactoring-RF2' of https://github.com/veg/hivtrac…
Browse files Browse the repository at this point in the history
…e-viz into 2024-refactoring-RF2
  • Loading branch information
spond committed Nov 11, 2024
2 parents 793815b + 478991b commit 2220c22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hivtrace-viz",
"version": "1.1.7",
"version": "1.2.0-alpha.3",
"description": "Visualization for the popular HIV-TRACE package",
"engines": {
"node": ">=18 || >20"
Expand Down
25 changes: 13 additions & 12 deletions src/hiv_tx_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -1564,18 +1564,19 @@ class HIVTxNetwork {

// remove any duplicate history entries from last 24 hours
// (retain entries within 24 hours only if they differ from the current entry)
pg.history = _.filter(
pg.history,
(h) =>
currDate - h.date > 24 * 60 * 60 * 1000 ||
h.size !== history_entry.size ||
h.national_priority !== history_entry.national_priority ||
h.cluster_dx_recent12_mo !==
history_entry.cluster_dx_recent12_mo ||
h.cluster_dx_recent36_mo !==
history_entry.cluster_dx_recent36_mo ||
h.new_nodes !== history_entry.new_nodes
);
pg.history = pg.history.filter(function (h) {
if (h.size !== history_entry.size
|| h.national_priority !== history_entry.national_priority
|| h.cluster_dx_recent12_mo !== history_entry.cluster_dx_recent12_mo
|| h.cluster_dx_recent36_mo !== history_entry.cluster_dx_recent36_mo
|| h.new_nodes !== history_entry.new_nodes) {
return true;
}
if (new Date(h.date) < new Date(new Date(currDate) - 24 * 60 * 60 * 1000)) {
return true;
}
return false;
});

pg.history.push(history_entry);
}
Expand Down

0 comments on commit 2220c22

Please sign in to comment.