Skip to content

Commit fd75446

Browse files
committed
Volunteer history, donations, adoptions appear on DataView page
1 parent ad5f82a commit fd75446

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/client/src/pages/DataView360/DataView360.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class DataView360 extends Component {
197197
<Donations donations={_.get(this.state, 'participantData.donations')}/>
198198
<Adoptions adoptions={_.get(this.state, 'participantData.adoptions')}/>
199199
<Volunteer volunteer={_.get(this.state, 'participantData.shifts')}
200-
volunteerShifts={_.get(this.state, 'participantData.volgistics_shifts_results')}/>
200+
volunteerShifts={_.get(this.state, 'participantData.shifts')}/>
201201

202202
</Paper>)}
203203
{this.state.isDataBusy === true && (

src/client/src/pages/DataView360/components/Adoptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Adoptions extends Component {
5252
</TableHead>
5353
<TableBody>
5454
<StyledTableRow>
55-
<TableCell align="center"> {_.size(this.getAnimalIds())}</TableCell>
55+
<TableCell align="center"> {_.size(this.props.adoptions)}</TableCell>
5656
</StyledTableRow>
5757
</TableBody>
5858
</Table>

src/server/api/common_api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from sqlalchemy.sql import text
55
import requests
66
import json
7+
import dateutil.parser
78
from secrets import SHELTERLUV_SECRET_TOKEN
89

910

@@ -52,7 +53,15 @@ def get_360(matching_id):
5253
if row["source_type"] == "volgistics":
5354
shifts_query = text("select * from volgisticsshifts where number = :volgistics_id")
5455
volgistics_shifts_query_result = connection.execute(shifts_query, volgistics_id=row["source_id"])
55-
volgisticsshifts_results = [dict(row) for row in volgistics_shifts_query_result]
56+
volgisticsshifts_results = []
57+
for r in volgistics_shifts_query_result:
58+
shifts = dict(r)
59+
# normalize date string
60+
parsed_date_from = dateutil.parser.parse(shifts["from"], ignoretz=True)
61+
normalized_date_from = parsed_date_from.strftime("%Y-%m-%d")
62+
shifts["from"] = normalized_date_from
63+
volgisticsshifts_results.append(shifts)
64+
5665
result['shifts'] = volgisticsshifts_results
5766

5867
if row["source_type"] == "shelterluvpeople":

0 commit comments

Comments
 (0)