Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#262 "Tasks" card improvements. #325

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

criske
Copy link
Contributor

@criske criske commented Jan 10, 2021

Fixes #262

tasks

@charlesmike
Copy link

@criske thank you for your Pull Request. I'll assign someone to review it soon.

@@ -42,10 +42,12 @@ public JsonTask(final Task task) {
super(
Json.createObjectBuilder()
.add("issueId", task.issueId())
.add("invoiceNumber", task.toString().split(":")[1])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amihaiemil Not a big fan of this... Maybe we could pass a StatusTask to JsonTask instead,
which in return would have an invoiceId() and a status() method.

@charlesmike
Copy link

@amihaiemil please review this Pull Request. Deadline (when it should be merged or closed) is 2021-01-13T15:26:10.383088.

You should check if the requirements have been implemented (partially or in full), if there are unit tests covering the changes and if the CI build passes. Feel free to reject the PR or ask for changes if it's too big or not clear enough.

Estimation here is 30 minutes, that's how much you will be paid. You will be paid even if this PR gets rejected.

@criske
Copy link
Contributor Author

criske commented Jan 10, 2021

@amihaiemil
Now that I'm looking at those values, something is wrong there?
In my db, the closed task has a value of 150euro and comission rate of 0.5. It looks like the Task from InvoicedTask ("closed" one) has the commission included in value, but the active tasks don't. Is this the correct behaviour?

Nvm: the task value for the closed one is ok, just checked the comission is in euro not in percent and is not added to the value.

- fix that will prevent contributor tasks from dashboard to crash
Copy link
Member

@amihaiemil amihaiemil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@criske just one question

* @version $Id$
* @since 0.0.1
*/
class AllTasks implements Tasks {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@criske Why do we need this class, what does it do exactly? :D

Also, can you write a puzzle for adding unit tests for it, if we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amihaiemil First of all this class is needed to JsonTasks, since it accepts only Tasks.
Then this class makes possible to list all contract invoiced tasks (closed taks) along with the active tasks (see the iterator implementation).
But the requirement was to show a task being active or closed with invoice id too. This is where StatusTask decorator comes. In iterator the active tasks are mapped to a StatusTask.Active impl where invoiced tasks are mapped to a StatusTask.Closed impl.
To display a task as active or closed(with invoice) I've just overriden toString() of StatusTask impls following this convention: active:- or closed:<invoiceId>, which is kinda hacky imo :D . And finally these are parsed by JsonTask if task is StatusTask.

And about testing, I think I'll test the whole tasks endpoint. I don't see any test targeting it.

@amihaiemil
Copy link
Member

@criske it looks nice, but same as the other PR with big table changes, let's postpone the merge a little bit.

@amihaiemil
Copy link
Member

@charlesmike deregister

@charlesmike
Copy link

@charlesmike deregister

@amihaiemil ok, I've removed this task from scope. I'm not managing it anymore.

- renamed `AllTasks` to `StatusTasks`
- `StatusTasks` scales better and has 3 convenient factory methods: `all()`, `active()` and `closed()`.
- Improved abstraction for `StatusTasks.StatusTask`: it has now `status()` and `invoiceId()` methods and thus making `JsonTask` to handle `StatusTasks.StatusTask` better.
- units tests for `JsonTask` handling `StatusTasks.StatusTask`.
- units tests for `ContractsApi#tasks` endpoint.
@criske
Copy link
Contributor Author

criske commented Jan 12, 2021

@amihaiemil I'll add tests for StatusTasks#active and StatusTasks#closed methods later (these aren't use anywhere at the moment anyway). StatusTasks#all() is tested along with ContractsApi#tasks endpoint and works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Tasks" card improvements
3 participants