Skip to content

Commit

Permalink
Adding support for unassigned projects
Browse files Browse the repository at this point in the history
  • Loading branch information
bhagyas committed Oct 17, 2020
1 parent 2a6c2c6 commit 88210de
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
14 changes: 12 additions & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,21 @@
<key>script</key>
<string>## Start Task
curl -X "POST" "https://web.timingapp.com/api/v1/time-entries/start" \
unassigned="Unassigned"
if [ "$project" != "$unassigned" ]; then
curl -X "POST" "https://web.timingapp.com/api/v1/time-entries/start" \
-H "Authorization: Bearer ${token}" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d "{\"title\": \"${task}\",\"project\": \"${project}\"}"
else
curl -X "POST" "https://web.timingapp.com/api/v1/time-entries/start" \
-H "Authorization: Bearer ${token}" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d "{\"title\": \"${task}\",\"project\": \"${project}\"}"</string>
-d "{\"title\": \"${task}\"}"
fi</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down
7 changes: 7 additions & 0 deletions projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ fetch('https://web.timingapp.com/api/v1/projects', {
arg: pr.title
};
});
//insert unassigned project at top
data.unshift({
uid: 0,
title: "Unassigned",
autocomplete: "Unassigned",
arg: "Unassigned"
});

output(inputMatches(data, 'title'));
});
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ You can create a new task or select the existing one (project will be selected a
## License

MIT © [skibitsky](http://skibitsky.com)

## Contributors
- Bhagya Silva (github.com/bhagyas)
2 changes: 1 addition & 1 deletion tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fetch('https://web.timingapp.com/api/v1/time-entries', {

var task = inputMatches(
sortedData.map(t => {
const project = t.project.title;
const project = t.project ? t.project.title : "Unassigned";
const title = (t.title) ? t.title : project;
return {
title: title,
Expand Down

0 comments on commit 88210de

Please sign in to comment.