Skip to content

Commit

Permalink
multiply data by 1000
Browse files Browse the repository at this point in the history
  • Loading branch information
Emre YILDIRIM authored and Emre YILDIRIM committed Aug 16, 2023
1 parent 1ada318 commit 35b5c4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions assets/js/components/ChartSourceController/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class ChartSourceController extends React.Component {
constructor(...props) {
super(...props);

console.log({props})

const {initial, items, type} = this.props;
const source = initial || Object.keys(items)[0];

Expand Down Expand Up @@ -106,14 +104,15 @@ class ChartSourceController extends React.Component {

fetchAndSetActualExpenditure(year, obj) {
let url = obj.url;
const multiplier = 1000;
fetchWrapper(url)
.then((response) => {
let barItems = this.state.barItems;
//one for each quarter
barItems[year][4] = response.summary['q1.sum']; //q1
barItems[year][5] = response.summary['q2.sum']; //q2
barItems[year][6] = response.summary['q3.sum']; //q3
barItems[year][7] = response.summary['q4.sum']; //q4
barItems[year][4] = response.summary['q1.sum'] > 0 ? response.summary['q1.sum'] * multiplier : null; //q1
barItems[year][5] = response.summary['q2.sum'] > 0 ? response.summary['q2.sum'] * multiplier : null; //q2
barItems[year][6] = response.summary['q3.sum'] > 0 ? response.summary['q3.sum'] * multiplier : null; //q3
barItems[year][7] = response.summary['q4.sum'] > 0 ? response.summary['q4.sum'] * multiplier : null; //q4

this.setState({
...this.state,
Expand Down
1 change: 1 addition & 0 deletions budgetportal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ def actual_expenditure_json(request):
if search_response["results"]:
for dataset_package in search_response["results"]:
dataset_obj = Dataset.from_package(dataset_package)

openspending_api = dataset_obj.get_openspending_api()
if openspending_api is not None:
department_ref = openspending_api.get_department_name_ref()
Expand Down

0 comments on commit 35b5c4e

Please sign in to comment.