Skip to content

Commit c399574

Browse files
committed
SSSSHH! comment out logs & fix compile warnings
1 parent 848fa15 commit c399574

File tree

10 files changed

+55
-72
lines changed

10 files changed

+55
-72
lines changed

src/DataParsers.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ function testGood (level, spotMeta) {
2424
.some( function (d) {
2525
if ( (d[0] < level) && ( level < d[1]) ) {
2626
// console.log(d);
27-
value = d[2]; return; }
27+
value = d[2]; return value; }
28+
return value
2829
});
2930
//console.log(value)
3031
return value
@@ -55,14 +56,14 @@ async function processWiskiData (spot, last) {
5556
start = moment(last).subtract(4, 'days').format('YYYY-MM-DD'),
5657
end = moment(last).format('YYYY-MM-DD'),
5758
url = `${baseURL + baseParams}&ts_id=${id}&from=${start}&to=${end}&dateformat=UNIX`;
58-
console.log('KIWIPROCESS', spot.gaugeType, spot, url)
59+
// console.log('KIWIPROCESS', spot.gaugeType, spot, url)
5960
return fetch(url)
6061
.then ( async (res) => {
61-
console.log(res.headers.get('Content-Type'))
62+
//console.log(res.headers.get('Content-Type'))
6263
return res.json()
6364
})
6465
.then ( (json) => {
65-
console.log('PROCESSWISKIJSON', json);
66+
// console.log('PROCESSWISKIJSON', json);
6667
return json[0].data
6768
.map( (item) => {
6869
let meta = {};
@@ -88,19 +89,19 @@ async function processWiskiData (spot, last) {
8889

8990
// let proxy = 'https://cors-anywhere.herokuapp.com/';
9091
async function getWOJSON (stationData, last, needCors = true) {
91-
console.log('RIVER', stationData)
92+
// console.log('RIVER', stationData)
9293
let start = moment(last).subtract(4, 'days').format('YYYY-MM-DD'),
9394
end = moment(last).format('YYYY-MM-DD'),
9495
headers = {Origin: "localhost"},
9596
params = `?param1=47&start_date=${start}&end_date=${end}&station=${stationData["gaugeID"]}`,
9697
cors = `https://hackinghistory.ca:9090/`, // `https://cors-anywhere.herokuapp.com/`
9798
url = `https://wateroffice.ec.gc.ca/services/real_time_graph/json/inline${params}`;
9899
if (needCors) {url = `${cors}${url}`;}
99-
console.log(url);
100+
// console.log(url);
100101
// let target = `${url}${params}`;
101102
return await fetch(url, {headers: headers})
102103
.then ( async (res) => {
103-
console.log(res.headers.get('Content-Type'))
104+
// console.log(res.headers.get('Content-Type'))
104105
return res.json()
105106
})
106107
.then ( (json) => { console.log(json);return json["47"].provisional} )
@@ -130,7 +131,7 @@ async function processWOData (spot, latest) {
130131
}
131132

132133
async function processGauge (spot, date, mapper=gaugeDict) {
133-
console.log('PROCCESSGAUGE', spot.gaugeType, mapper[spot.gaugeType]);
134+
// console.log('PROCCESSGAUGE', spot.gaugeType, mapper[spot.gaugeType]);
134135
if (mapper[spot.gaugeType]) return await mapper[spot.gaugeType](spot, date);
135136
return
136137
}
@@ -144,7 +145,7 @@ class DataParser {
144145

145146
async process(spot) {
146147
const m=this.gaugeMap
147-
console.log(spot.gaugeType, m[spot.gaugeType]);
148+
// console.log(spot.gaugeType, m[spot.gaugeType]);
148149
return await m[spot.gaugeType](spot);
149150

150151
}

src/components/fbLogin.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ import {compareJournals} from '../utils/utils.js'
4848
dispatch({type: 'LOGOUT'});
4949

5050
}
51-
useEffect (() => {
52-
console.log('GOTUSERID', user && user.uid)
53-
})
51+
// useEffect (() => {
52+
// console.log('GOTUSERID', user && user.uid)
53+
// })
5454

5555
return (
5656
<>

src/components/journal.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export class Journal extends React.Component {
2626

2727
render() {
2828

29-
console.log("rendering main journal")
30-
console.log('MAINJOURNALENTRIES', this.props.entries)
29+
// console.log("rendering main journal")
30+
// console.log('MAINJOURNALENTRIES', this.props.entries)
3131

3232
return (
3333
<div className="journal">
@@ -48,13 +48,13 @@ class JournalAllEntries extends React.Component {
4848

4949
}
5050
render() {
51-
console.log("rerendering entries")
52-
console.log('ALLENTRIES', this.props.entries)
51+
// console.log("rerendering entries")
52+
// console.log('ALLENTRIES', this.props.entries)
5353
if (this.props.entries && this.props.entries.length > 0){
5454
const visibleEntries = this.props.filters ?
5555
filterEntries(this.props.filters, this.props.entries) :
5656
this.props.entries
57-
console.log('ALLENTRIESFILTERED', this.props.filters,visibleEntries)
57+
// console.log('ALLENTRIESFILTERED', this.props.filters,visibleEntries)
5858
return (
5959

6060
<div className="journal-entries">
@@ -67,7 +67,7 @@ class JournalAllEntries extends React.Component {
6767
<JournalRow key={dataObj.id} id={dataObj.id} spot={dataObj.spot}
6868
date={dataObj.date} entry={dataObj.entry} rating={dataObj.rating}
6969
showForm={false}/> )}
70-
{this.props.entries.forEach( (entry, index) => console.log('MAPPINGENTRIES',entry, index))}
70+
{/* {this.props.entries.forEach( (entry, index) => console.log('MAPPINGENTRIES',entry, index))} */}
7171
</div>
7272

7373
)

src/components/journalFilter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {connect} from 'react-redux'
55
import {initialState} from '../reducers/initialState.js'
66

77
function mapStateToProps(state,ownProps) {
8-
console.log('FILTERS?', state)
8+
// console.log('FILTERS?', state)
99
return {
1010
filters: state.journalFilter}
1111
}
@@ -24,7 +24,6 @@ export class JournalFilter extends React.Component {
2424
// : false ;
2525
handleSubmit = (event) => {
2626
event.preventDefault();
27-
console.log('SUBMIT', this.state)
2827
let {rating, spot, last} = this.state;
2928
if (spot==='none') spot=false;
3029
this.props.dispatch({
@@ -47,7 +46,7 @@ export class JournalFilter extends React.Component {
4746
};
4847

4948
clearFilters = () => {
50-
console.log('CLEARFILTER', initialState.journalFilter)
49+
// console.log('CLEARFILTER', initialState.journalFilter)
5150
this.props.dispatch ({type: 'SET_FILTER', payload: initialState.journalFilter})}
5251

5352
render() {

src/components/sessionInfo.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import Waterchart from '../components/waterchart.js'
88

99
function getSpot (slug) {
1010
let value;
11-
console.log("GETSPOT", slug)
1211
for (const r of Rivers) {
13-
console.log('GETSPOT', r.slug, slug);
1412
if (r.slug === slug ) {value = r;}
1513
}
1614
return value;

src/components/waterchart.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function mapStateToProps(state, ownProps) {
2323
seriesdata = chartInfo && chartInfo.gaugeData,
2424
height = chartInfo && chartInfo.height,
2525
width = chartInfo && chartInfo.width
26-
console.log('CHARTMAPPER', chartId, state.charts[chartId], ownProps)
26+
// console.log('CHARTMAPPER', chartId, state.charts[chartId], ownProps)
2727
return {
2828
height: height,
2929
width: width,
@@ -88,7 +88,7 @@ const waterchartDefaultOptions = {
8888
export class Waterchart extends Component {
8989
constructor(props) {
9090
super(props)
91-
console.log("UPDATECHART IN CONSTRUCTOR", this.spotDef, this.props.date, this.props.spotslug, this.props)
91+
// console.log("UPDATECHART IN CONSTRUCTOR", this.spotDef, this.props.date, this.props.spotslug, this.props)
9292

9393
this.spotDef = getSpot(this.props.spotslug)
9494
this.chartRef = React.createRef();
@@ -104,10 +104,10 @@ export class Waterchart extends Component {
104104
deleteData = () => this.props.dispatch({type: 'DELETE_CHART',
105105
id: this.props.chartId})
106106
updateData = () => {
107-
console.log("UPDATECHART", this.spotDef, this.props.date, this.props.spotslug, this.props)
107+
// console.log("UPDATECHART", this.spotDef, this.props.date, this.props.spotslug, this.props)
108108
this.spotDef && isRiver(this.props.spotslug) && processGauge(this.spotDef, this.props.date || Date.now() )
109109
.then (data =>{
110-
console.log('UPDATECHARTDATA', data)
110+
// console.log('UPDATECHARTDATA', data)
111111
this.props.dispatch({type: 'UPDATE_CHART',
112112
id: this.props.chartId,
113113
payload: {gaugeData: data},
@@ -119,7 +119,7 @@ export class Waterchart extends Component {
119119

120120

121121
componentDidMount = () => {
122-
console.log('DIDMOUNT', this.props.seriesdata)
122+
//console.log('DIDMOUNT', this.props.seriesdata)
123123
if (!this.props.seriesdata) {
124124
this.updateData()
125125
}

src/libraries/chartist-segmented-line.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
*/
88

99
export default function Segment (globalRoot, Chartist){
10-
console.log("trying to generate chart");
11-
// var window = globalRoot.window;
12-
// var document = globalRoot.document;
13-
1410
/**
1511
* Default options in line charts. Expand the code view to see a detailed list of options with comments.
1612
*
@@ -175,7 +171,7 @@ export default function Segment (globalRoot, Chartist){
175171
meta: Chartist.getMetaData(segment, valueIndex) // value.meta// Chartist.getMetaData(series, valueIndex)
176172
});
177173
});
178-
console.log(pathCoordinates, pathData);
174+
// console.log(pathCoordinates, pathData);
179175

180176
}
181177

@@ -254,8 +250,8 @@ export default function Segment (globalRoot, Chartist){
254250
segParent = {seriesElement, rect:chartRect, axisX, axisY, data, seriesIndex};
255251
//segments.forEach( (seg, index) => drawSegment (seg, index, segParent));
256252
//data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {
257-
console.log(segments);
258-
let testCase;
253+
// console.log(segments);
254+
// let testCase;
259255
// use arrow function to avoid binding `this`; segments aren't proper chartist objs
260256
segments.forEach( function makeSegElements (segment, segmentIndex) {
261257
//console.log("seg name is defined?");
@@ -266,8 +262,8 @@ export default function Segment (globalRoot, Chartist){
266262
'ct:series-name': series.name
267263
//'ct:meta': Chartist.serialize(series.meta) // no meta data for this yet
268264
});
269-
segment.points[0] === testCase ? console.log(`oh no! first element of segment ${segmentIndex} = the one before`) : testCase = segment.points[0];
270-
console.log(testCase);
265+
//segment.points[0] === testCase ? console.log(`oh no! first element of segment ${segmentIndex} = the one before`) : testCase = segment.points[0];
266+
// console.log(testCase);
271267
// Use series class from series data or if not set generate one
272268
segmentElement.addClass([
273269
options.segmentClassPrefix + segment.name,
@@ -306,7 +302,7 @@ export default function Segment (globalRoot, Chartist){
306302
// Interpolating path where pathData will be used to annotate each path element so we can trace back the original
307303
// index, value and meta data
308304
var segmentPath = smoothing(segmentPathCoordinates, segmentPathData);
309-
console.log(`SEGMENT PATH ELEMTNST HAS LENGTH ${segmentPath.pathElements.length}`)
305+
//console.log(`SEGMENT PATH ELEMTNST HAS LENGTH ${segmentPath.pathElements.length}`)
310306
// If we should show points we need to create them now to avoid secondary loop
311307
// Points are drawn from the pathElements returned by the interpolation function
312308
// Small offset for Firefox to render squares correctly
@@ -322,7 +318,7 @@ export default function Segment (globalRoot, Chartist){
322318
'ct:value': [pathElement.data.value.x, pathElement.data.value.y].filter(Chartist.isNumeric).join(','),
323319
'ct:meta': Chartist.serialize(pathElement.data.meta)
324320
});
325-
if (index == 2) {(console.log("2!!!!", pathElement.data.meta.direction))}
321+
// if (index == 2) {(console.log("2!!!!", pathElement.data.meta.direction))}
326322
this.eventEmitter.emit('draw', {
327323
type: 'point',
328324
value: pathElement.data.value,

src/libraries/react-chartist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ChartistGraph extends Component {
5151
updateChart(config) {
5252
let Chartist = require('chartist');
5353
let { type, data } = config;
54-
console.log('UPDATECHART RUNNING W NEW DATA', data)
54+
//console.log('UPDATECHART RUNNING W NEW DATA', data)
5555
let options = config.options || {};
5656
let responsiveOptions = config.responsiveOptions || [];
5757
let event;

src/reducers/mainReducer.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import { combineReducers } from 'redux';
1+
// import { combineReducers } from 'redux';
22
import authReducer from './authReducer.js'
33
import {initialState } from './initialState.js'
4-
function updateObject(oldObject, newValues) {
5-
// Encapsulate the idea of passing a new object as the first parameter
6-
// to Object.assign to ensure we correctly copy data instead of mutating
7-
return Object.assign({}, oldObject, newValues)
8-
}
4+
// function updateObject(oldObject, newValues) {
5+
// // Encapsulate the idea of passing a new object as the first parameter
6+
// // to Object.assign to ensure we correctly copy data instead of mutating
7+
// return Object.assign({}, oldObject, newValues)
8+
// }
99

10-
function updateItemInArray(array, itemId, updateItemCallback) {
11-
const updatedItems = array.map(item => {
12-
if (item.id !== itemId) {
13-
// Since we only want to update one item, preserve all others as they are now
14-
return item
15-
}
16-
// Use the provided callback to create an updated item
17-
const updatedItem = updateItemCallback(item)
18-
return updatedItem
19-
})
20-
return updatedItems
21-
}
10+
// function updateItemInArray(array, itemId, updateItemCallback) {
11+
// const updatedItems = array.map(item => {
12+
// if (item.id !== itemId) {
13+
// // Since we only want to update one item, preserve all others as they are now
14+
// return item
15+
// }
16+
// // Use the provided callback to create an updated item
17+
// const updatedItem = updateItemCallback(item)
18+
// return updatedItem
19+
// })
20+
// return updatedItems
21+
// }
2222

2323

2424
function journalReducer(journalState=[], action) {
@@ -90,7 +90,7 @@ export function journalFilterReducer (filterState=[], action) {
9090
export default function mainReducer(state=initialState, action) {
9191
// just gonna leave this blank for now
9292
// which is the same as `return undefined;`
93-
console.log('REDUCING!')
93+
// console.log('REDUCING!')
9494
return {
9595

9696
charts: chartsReducer(state.charts, action),

src/utils/utils.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import Rivers from '../rivers.js'
44
import Breaks from '../surfspots.js'
55
export function getSpot (slug) {
66
let value;
7-
console.log("GETSPOT", slug)
87
for (const r of Rivers) {
9-
console.log('GETSPOT', r.slug, slug);
108
if (r.slug === slug ) {value = r;}
119
}
1210
for (const b of Breaks) {
13-
console.log('GETSPOT', b.slug, slug);
1411
if (b.slug === slug ) {value = b;}
1512

1613
}
@@ -24,22 +21,18 @@ export function isRiver (slug) {
2421
}
2522

2623
export function compareJournals (local, cloud) {
27-
console.log('RUNNING COMPAREJOURNALS')
2824
// cloud= snapshot.val()
2925
let uid = store.getState().user?.user
30-
console.log('UID', uid)
26+
// console.log('UID', uid)
3127
let myLocalEntries = local[uid]
3228
if (myLocalEntries) {
3329
let localCopy = [...myLocalEntries]
3430
for (let id in cloud) {
35-
console.log('ENTRYID', id, localCopy)
3631
//const isHere = local.filter(local => local.id === id)
3732
const localIndex = localCopy.findIndex(function(i){
3833
return i.id === id;
3934
})
40-
console.log('ENTRYID', localIndex)
4135
if (localIndex < 0) {
42-
console.log('NOENTRY', `no entry for ${id}`)
4336
const {date, entry, spot, updated, rating} = cloud[id];
4437
store.dispatch({type: 'ADD_ENTRY', payload:{spot, date, entry, id, rating, updated}})
4538
} else {
@@ -59,10 +52,7 @@ export function compareJournals (local, cloud) {
5952
}
6053
localCopy.splice(localIndex, 1);
6154
}
62-
for (let e of localCopy) {
63-
console.log('LOCALCOPY', e)
64-
//store.dispatch({type: 'DELETE_ENTRY', payload: {id: e.id}})
65-
}
55+
6656
}
6757
// if (isHere.length === 0) {
6858
// } else if (isHere[0].updated > cloud[id].updated) {
@@ -77,5 +67,4 @@ export function compareJournals (local, cloud) {
7767
store.dispatch({type: 'ADD_ENTRY', payload:{spot, date, entry, id, updated, rating}})
7868
}
7969
}
80-
console.log('FBENTRIES', cloud)
8170
}

0 commit comments

Comments
 (0)