Created
June 21, 2020 18:15
-
-
Save baywet/38f21c202db5baf22a630ccbb7bae2ef to your computer and use it in GitHub Desktop.
This file contains 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
import { ACTIVITY_TYPE_DIGITAL, DIGITAL_CATEGORY_EMAIL } from '../../definitions'; | |
export const modelName = 'email'; | |
export const modelVersion = '1'; | |
export const explanation = { | |
text: | |
'Calculations take into account the direct emissions associated with the email infrastructure worldwide.', | |
links: [ | |
{ | |
label: 'Phys.org (2015)', | |
href: 'https://phys.org/news/2015-11-carbon-footprint-email.html', | |
}, | |
], | |
}; | |
export const modelCanRunVersion = 1; | |
export function modelCanRun(activity) { | |
const { activityType } = activity; | |
const isDigitalActivity = ACTIVITY_TYPE_DIGITAL === activityType; | |
return ( | |
isDigitalActivity && | |
activity.lineItems && | |
activity.lineItems.filter(x => x.identifier === DIGITAL_CATEGORY_EMAIL).length > 0 | |
); | |
} | |
const worldCarbonIntensity = 4; // g/email | |
export function carbonEmissions(activity) { | |
return ( | |
(activity.lineItems.filter(x => x.identifier === DIGITAL_CATEGORY_EMAIL).length * | |
worldCarbonIntensity) / | |
1000.0 | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment