-
Notifications
You must be signed in to change notification settings - Fork 1
Comment improvements #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dambem
wants to merge
2
commits into
master
Choose a base branch
from
docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Comment improvements #132
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,14 +71,23 @@ function mortality(PM10, PM2, people, id, preface) { | |
| var mortalityOnPeoplePM2 = people * (percentageMortalityPM2 * 0.01) | ||
| } | ||
| human_display(people, mortalityOnPeoplePM10 + mortalityOnPeoplePM2, id, preface) | ||
| } | ||
| }/** | ||
| * Cigarette calculation for the pollution values | ||
| * @param {float} PM2 - Average PM2 Value | ||
| */ | ||
| function cigarettes(pm2) { | ||
| var base_level = 22.0 | ||
| var pm2_per_week = (pm2 * 7.0)/base_level; | ||
| var pm2_per_year = (pm2 * 365.0) / base_level; | ||
| return [pm2_per_week, pm2_per_year] | ||
| } | ||
|
|
||
| /** | ||
| * Cigarette display for the pollution values | ||
| * @param {int} cigarettes - Amount of weekly cigarettes | ||
| * @param {string} id - id of the location to append | ||
| * @param {string} preface - The preface of the div | ||
| */ | ||
| function cigarette_display(cigarettes, id, preface) { | ||
| var weekly = cigarettes[0] | ||
| var yearly = cigarettes[1] | ||
|
|
@@ -110,7 +119,13 @@ function fractionalreducer(numerator, denominator) { | |
| gcd = gcd(numerator, denominator) | ||
| return [numerator/gcd, denominator/gcd] | ||
| } | ||
|
|
||
| /** | ||
| * Human display, append HTML with showing how many people would lose they're lives due to pollution | ||
| * @param {int} people - Amount of people | ||
| * @param {int} infected - Amount of people | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amount of people infected? |
||
| * @param {string} id - id of the location to append | ||
| * @param {string} preface - The preface of the div | ||
| */ | ||
| function human_display(people, infected, id, preface) { | ||
| if (preface == null) { | ||
| preface = "<p></p>" | ||
|
|
@@ -175,15 +190,21 @@ function human_display(people, infected, id, preface) { | |
|
|
||
| } | ||
|
|
||
| // Function for removing data from charts | ||
| /** | ||
| * Remove data, function for clearing all the data from a chart | ||
| * @param {Object} chart - chartJS chart object | ||
| */ | ||
| function removeData(chart) { | ||
| chart.data.labels.pop(); | ||
| chart.data.datasets.forEach((dataset) => { | ||
| dataset.data.pop(); | ||
| }); | ||
| chart.update(); | ||
| } | ||
|
|
||
| /** | ||
| * linkExists | ||
| * @param {id} sensorID - checks against sensorID to ensure that a link exists at a certain date | ||
| */ | ||
| function linkExist(id) { | ||
| jsonData = {'id': id} | ||
| $.ajax({ | ||
|
|
@@ -202,7 +223,11 @@ function linkExist(id) { | |
| }) | ||
| } | ||
|
|
||
| // Function that returns different phrase based on pollution | ||
| /** | ||
| * colour for pollution phrase, returns a phrase based on certain PM10 and PM2.5 values | ||
| * @param {float} PM10 - pm10 pollution value | ||
| * @param {float} PM2.5 - pm2.5 pollution value | ||
| */ | ||
| function colorForPollutionPhrase(pm10, pm2) { | ||
| if (pm10 >= 20 && pm10 < 30 || pm2 >= 10 && pm2 < 15) { | ||
| return "The pollution levels are just above WHO guidelines for safe pollution, and can lead to long term health issues" | ||
|
|
@@ -228,9 +253,11 @@ function colorForPollutionPhrase(pm10, pm2) { | |
| } | ||
| /* | ||
|
|
||
| /* | ||
| * Function that returns different colours based on pollution | ||
| */ | ||
| /** | ||
| * colour for pollution , returns a colour based on certain PM10 and PM2.5 values | ||
| * @param {float} PM10 - pm10 pollution value | ||
| * @param {float} PM2.5 - pm2.5 pollution value | ||
| */ | ||
| function colorForPollution(pm10, pm2) { | ||
| if (pm10 >= 20 && pm10 < 30 || pm2 >= 10 && pm2 < 15) { | ||
| return light | ||
|
|
@@ -255,9 +282,10 @@ function colorForPollution(pm10, pm2) { | |
| } | ||
| } | ||
|
|
||
| /* | ||
| * This function builds the link to the sensor CSV given a certain date. | ||
| */ | ||
| /** | ||
| * Builds a link to the archive from a certain date | ||
| * @param {date} date - date object | ||
| */ | ||
| function build_link_from_date(date) { | ||
| var year = date.getFullYear(); | ||
| var month = date.getMonth() + 1; | ||
|
|
@@ -571,7 +599,11 @@ $(document).ready(() => { | |
| popupAnchor: [0, -50], // point from which the popup should open relative to the iconAnchor | ||
| altText: "A marker representing pollution levels that are too high" | ||
| }) | ||
|
|
||
| /** | ||
| * icon for pollution , returns a map icon based on certain PM10 and PM2.5 values | ||
| * @param {float} PM10 - pm10 pollution value | ||
| * @param {float} PM2.5 - pm2.5 pollution value | ||
| */ | ||
| function iconForPollution(pm10, pm2) { | ||
| if (pm10 >= 20 && pm10 < 30 || pm2 >= 10 && pm2 < 15) { | ||
| return lightPollutionIcon | ||
|
|
@@ -646,6 +678,10 @@ $(document).ready(() => { | |
| }, | ||
| }); | ||
| var currentValidDates = [] | ||
| /** | ||
| * find dates, based on an id and amount of days, finds out how many sensor details are located on it. | ||
| * @param {string} id_chosen - id for sensor | ||
| */ | ||
| function findDates(id_chosen) { | ||
| days_found = parseInt(document.getElementById("days").value) | ||
| jsonData = { id: id_chosen, days: days_found } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*their lives