Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix some granule size issues

Jason Kent3746561a2c39
diff --git a/web/js/components/smart-handoffs/granule-count.js b/web/js/components/smart-handoffs/granule-count.js
index 301ec4665..75b0c8981 100644
--- a/web/js/components/smart-handoffs/granule-count.js
+++ b/web/js/components/smart-handoffs/granule-count.js
@@ -35,14 +35,16 @@ export default function GranuleCount (props) {
};
const getDownloadSize = (entries) => entries.reduce(
- (prev, curr) => prev + parseInt(curr.granule_size, 10), 0,
+ (prev, curr) => (
+ curr.granule_size ? prev + parseInt(curr.granule_size, 10) : 0),
+ 0,
);
/**
* Fetch granule data for the specified selected layer/collection
*/
const updateGranules = async () => {
- const { southWest, northEast } = currentExtent || {};
+ const { southWest, northEast } = currentExtent;
let newTotalGranules = 0;
let newSelectedGranules;
let newGranuleDownloadSize = 0;
@@ -59,7 +61,7 @@ export default function GranuleCount (props) {
const granulesRequestUrl = granulesBaseUrl + util.toQueryString(params);
- if (currentExtent) {
+ if (southWest && northEast) {
const bboxRequestUrl = `${granulesRequestUrl}&bounding_box=${southWest},${northEast}`;
const selectedEntries = await requestGranules(bboxRequestUrl);
newSelectedGranules = selectedEntries.length;
@@ -96,7 +98,10 @@ export default function GranuleCount (props) {
);
const renderDownloadSize = () => {
- const printSize = (s) => Number(s).toFixed(0).toLocaleString();
+ const printSize = (s) => {
+ const wholeNum = Number(s).toFixed(0);
+ return Number(wholeNum).toLocaleString();
+ };
let sizeText;
if (granuleDownloadSize > 1000) {
sizeText = `${printSize(granuleDownloadSize / 1000)} GB`;
diff --git a/web/js/containers/sidebar/smart-handoff.js b/web/js/containers/sidebar/smart-handoff.js
index 571a3bac5..ba5c3fb90 100644
--- a/web/js/containers/sidebar/smart-handoff.js
+++ b/web/js/containers/sidebar/smart-handoff.js
@@ -50,7 +50,7 @@ class SmartHandoff extends Component {
y2: screenHeight / 2 + 100,
},
showBoundingBox: false,
- currentExtent: undefined,
+ currentExtent: {},
coordinates: {},
};
@@ -414,7 +414,7 @@ class SmartHandoff extends Component {
{this.renderCropBox()}
<GranuleCount
displayDate={displayDate}
- currentExtent={showBoundingBox ? currentExtent : undefined}
+ currentExtent={showBoundingBox ? currentExtent : {}}
selectedDate={selectedDate}
selectedLayer={selectedLayer}
selectedCollection={selectedCollection}