diff --git a/mobile/src/API.js b/mobile/src/API.js
index a3b06f0..44f0470 100644
--- a/mobile/src/API.js
+++ b/mobile/src/API.js
@@ -366,6 +366,10 @@ class API extends EventEmitter {
return this.delete("/workitems/" + _id)
}
+ listTeams() {
+ return this.get("/teams")
+ }
+
getActivity(_id) {
return this.get("/activities/" + _id)
}
diff --git a/mobile/src/Activity/Activity.js b/mobile/src/Activity/Activity.js
index 7f2b2ed..00e118b 100644
--- a/mobile/src/Activity/Activity.js
+++ b/mobile/src/Activity/Activity.js
@@ -106,6 +106,7 @@ export class Activity extends React.Component {
this.setState({
binder: new FormBinder(
{
+ ...this.state.binder.getOriginalFieldValues(),
workItem: workItem._id,
team: api.loggedInUser.team,
},
@@ -143,7 +144,7 @@ export class Activity extends React.Component {
binder: new FormBinder(activity, Activity.bindings),
})
- getWorkItem(activity.workItemId)
+ return getWorkItem(activity.workItem)
}
})
.catch((err) => {
diff --git a/mobile/src/Home/Home.js b/mobile/src/Home/Home.js
index 02b7381..c713a1f 100644
--- a/mobile/src/Home/Home.js
+++ b/mobile/src/Home/Home.js
@@ -31,6 +31,7 @@ import KeyboardSpacer from "react-native-keyboard-spacer"
import hardhatPinImage from "./images/hardhat-pin.png"
import clipboardPinImage from "./images/clipboard-pin.png"
import questionPinImage from "./images/question-pin.png"
+import moment from "moment"
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
const neverAskForCameraKeyName = "NeverAskForCameraPermission"
@@ -92,8 +93,19 @@ export class Home extends React.Component {
)
api
- .listWorkItemActivities()
+ .listTeams()
.then((list) => {
+ this.teams = list.items
+ return api.listWorkItemActivities()
+ })
+ .then((list) => {
+ list.items.forEach((item) => {
+ item.data.forEach((datum) => {
+ const team = this.teams.find((team) => team._id === datum.team)
+
+ datum.teamName = team ? team.name : "???"
+ })
+ })
this.setState({
sections: list.items,
region:
@@ -104,7 +116,13 @@ export class Home extends React.Component {
})
})
.catch((err) => {
- console.error(err)
+ this.setState({
+ messageModal: {
+ icon: "hand",
+ message: "Unable to get a list of work items, activities and teams",
+ detail: err.message,
+ },
+ })
})
}
@@ -440,7 +458,9 @@ export class Home extends React.Component {
{activity.resolution}
- {activity.when}
+ {activity.teamName +
+ " | " +
+ dotify(moment(activity.createdAt).format())}
diff --git a/server/src/api/routes/WorkItemRoutes.js b/server/src/api/routes/WorkItemRoutes.js
index a520b3f..c5c1c57 100644
--- a/server/src/api/routes/WorkItemRoutes.js
+++ b/server/src/api/routes/WorkItemRoutes.js
@@ -107,6 +107,8 @@ export class WorkItemRoutes {
"data._id": 1,
"data.resolution": 1,
"data.status": 1,
+ "data.createdAt": 1,
+ "data.team": 1,
})
const items = await aggregate.exec()