Comments

cgalli’s picture

Component: Core » Translator: Local

Reassign to tmgmt_local

miro_dietiker’s picture

Assigned: Unassigned » blueminds
berdir’s picture

Assigned: blueminds » berdir

I'm working on this, needs task_item entity first.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new178.79 KB

That took quite a bit longer than expected, typical task that grew too big.

This is not yet complete, most importantly, it's missing the main point of this issue, storing partial translates in task_item entity.

It however does a lot already:
- Introduces task_item entity with an 1:1 mapping to job items
- Separate statuses for that (untranslated, translated (means pending review by job requester), rejected (not yet implemented) and completed (marked once job item was accepted)
- Improved permission handling, although tmgmt_local_translation_access() is still around (should be merged into entity access)
- Refactored views a lot. Single operations column, using local tasks with user-menu links instead of links in the sidebar, updated to use the task_entity, improved assign etc. permission checks

The most important parts that are missing currently are:
- Storing the translations in the task item until it's saved as completed, then copy it over to the job item, removing the custom write and status changes.
- Adding the progress stuff to task items, this could be a follow-up?

berdir’s picture

Also, upgrade path is missing.

cgalli’s picture

Status: Needs review » Needs work
StatusFileSize
new10.17 KB

Applied the patch to a new install. It looks good (tabs instead of menu, changed naming of action links etc).

I found the follwing difficulties:

The 'unassign' link is a very good idea. But it does not yet seem to work correctly. Changing only the status to 'unassigned' (but leaving the persons name on myself) list the task as unassigned to me. When changing the status and the assigned person, it works fine.

In the translation pane, using teh ckeckmark button leads to an ajax error:
Ajax error.png

When using with 'auto accept' off, finishing a translation leads to:
- In the node source list, the yellow square shows correctly
- In the translation management overview and detail, the 'review' link does not show. The job message is displayed, but the status (including colored circle) remains on blue/pending.
- in the review pane, the job items show in gray, but can be checked and turn to green.
- Saving the job as completed leads to status 'accepted' and the translation is created.

cgalli’s picture

Quick addition:

The 'Local Task' tab does not show up anymore in translation management.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new6 KB
new21.63 KB

Ok, that turned out to be quite easy, actually, and surprisingly nice.

The attached patch fixes/does the following (order as it's in the interdiff):
- Improved entity label that uses the title when given and makes the assigned to part optional
- Copies the updateData() and getData() methods from JobItem to TaskItem.
- Updates some action/form access logic (hide form elements if you are not allowed to change them, only display translate link to someone who is assigned to the task, only show unassign if someone is assigned, ...)
- Makes the list of task items shown on the task page actually specific for that task ;)
- Should fix and propertly re-introduce the unassign action
- Saves translations in the task item and then copies them over on save as completed.
- Fixed the ajax error
- Updates the upgrade path to copy over existing translations from the job item to the task item.
- Using the links class on the operations so that they don't have tons of spacing as before

This should be pretty close, the only major part that's missing are the status counters.

berdir’s picture

StatusFileSize
new23.01 KB
new191.83 KB

Oh wow, just picked the latest patch with interdiff in my patches directory.. unfortunately, it was the 8.x patches directory :p

berdir’s picture

+++ b/translators/tmgmt_local/includes/tmgmt_local.pages.incundefined
@@ -197,19 +206,19 @@ function tmgmt_local_translation_form_save_as_completed_submit($form, &$form_sta
-  // Set the job item to 'needs review' and task to finished states.
-  $job_item->needsReview();
+  // Add the translations to the job item.
+  $job_item->addTranslatedData($task_item->getData());

It's pretty awesome that this just works like that ;)

Status: Needs review » Needs work

The last submitted patch, task-entity-1895380-8.patch, failed testing.

berdir’s picture

Status: Needs work » Needs review

#9: task-entity-1895380-8.patch queued for re-testing.

cgalli’s picture

Status: Needs review » Needs work

Applied the path to existing installation.

The upgrades (7000 and 7001) passed fine.

When I tried to finish a previously started job (Drupal Translator, not Local), 'Save as completed' did not finish the job, the review pane is still active. Hitting it again leads to:

Fatal error: Call to a member function completed() on a non-object in /var/www/tmgmt/sites/all/modules/tmgmt/translators/tmgmt_local/tmgmt_local.module on line 722

Previously started jobs with Local Tranlslator came back without any problem.

Started new job, submitted it to Local.

Hitting 'Translate' (http://tmgmt.hookuser.ch/translate, as a translating user) leads to:
Fatal error: Call to a member function isActive() on a non-object in /var/www/tmgmt/sites/all/modules/tmgmt/translators/tmgmt_local/tmgmt_local.module on line 257

'Manage translation tasks' can be used.

miro_dietiker’s picture

Are you sure you're not having the module/project twice and there's an unpatched and a patched version in place (check all modules directories)?
Did you drush cc all?

Please confirm.

cgalli’s picture

yes. did it again, does not change.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new4.3 KB
new193.42 KB

- Fixed the error when saving a job item from a different translator as completed.
- The other fatal error I think is because you have old translation tasks that point to deleted jobs. Added a check for that for now, the whole function needs to be integrated into the entity access system anyway.
- Made some more small updates to the task overview (/translate) view, somehow got moved back to the navigation menu.

miro_dietiker’s picture

Interdiff - feasible... Few text fixes required.

+++ b/translators/tmgmt_local/views/tmgmt_local_task_overview.view.incundefined
@@ -163,11 +163,11 @@ $handler->display->display_options['filters']['status']['expose']['remember_role
+$handler->display->display_options['display_description'] = 'Shows elegible (unassigned) and mine tasks.';

@@ -2321,11 +2322,11 @@ $translatables['tmgmt_local_task_overview'] = array(
+  t('Shows elegible (unassigned) and mine tasks.'),

@@ -2334,6 +2335,7 @@ $translatables['tmgmt_local_task_overview'] = array(
   t('Shows elegible (unasigned) tasks.'),

elegible => eligible
unasigned => unassigned

Please check similar nonfunctional occurrences too...

cgalli’s picture

Installed the patch (not interdiff) on existing installation. update works fine.

Looking excellent, it's a friggin cool system by now!

I tried to test different combination (node, entity) but found no major functional problem. Some remaks about logic below.
Upgrade path

- Returning jobs from Drupal Translator can be reviewed and saved, no problem
- Same for local jobs created before the patch.

Remarks:

The status circles in the two worlds are still corresponding.

When completeing a task (Save as complete) shouldn't we redirect to the 'translate' page?

In the Local Translator, a completed task item can be viewed (which is good). But the 'Save'/'Save as completed' buttons are still active, which does not make sense for a finished job? The same goes for the Data Item check marks.

A completed task can still be unassigned. We need to decide if this makes sense. If it does, there should be a status column in the upper list.

Deleting a job in core leads to a notice in the translator:
Notice: Trying to get property of non-object in tmgmt_local_task_form() (line 48 of /var/www/tmgmt/sites/all/modules/tmgmt/translators/tmgmt_local/includes/tmgmt_local.pages.inc).
Makes sense, but possibly leaves a dangling entity somewhere. The task is still listed in lower table, no word count, no item count

cgalli’s picture

Status: Needs review » Needs work
berdir’s picture

Fixed some more. Haven't introduced those strings, just started to fix those that I noticed.

berdir’s picture

Thanks for testing. Some feedback.

- Yes, the current word counts are still joined in from the job/ job item I think. Need to update that to store the statistics in the local task item.
- Redirect should probably depend on whether there are more task items in the task or not.
- Wasn't sure about handling the buttons on completed task items, agree that hiding them makes sense on completed task items. Needs a back link or something like that, then.
- On the task, we currently have completed *and* closed. Right now, a task is set to completed if all task items within are translated. Closed is not yet implemented, I assume we should set it to closed once all task items are completed just like the job is finished after all job items are accepted. Which makes me wonder if completed is the right status for task items. Maybe it would make more sense to name it accepted as well? Untranslated => Translated (TBD: => Revision requested) => Accepted ?
- So, the changing the assignment of a completed job could be allowed although not sure if it's useful, of a closed job probably not. At least not directly on the operations, an admin could still edit the job and change it there...

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new31.8 KB
new213.08 KB

This needs to get in :)

- Added data item status/progress for local task items: Untranslated/Translated/Completed
- Changed the statuses of local task items from Untranslated/Translated/Completed to Pending/Completed (everything translated)/Closed (job item accepted)
- Also implemented that tasks are closed when all contained task items are closed.
- Updated the my tasks view to exclude closed tasks, they can be access through the closed tab.
- Updated TMGMTLocalTask::getItems() to return task items and not job items.
- Updated/extended tests.
- Redirect is now dynamic, based on wether task has additional untranslated items, as long as that's the case you go back to the task detail page, /translate otherwise.

Status: Needs review » Needs work

The last submitted patch, task-item-entity-1895380-22.patch, failed testing.

cgalli’s picture

Applied patch

- Update leads to:
Notice: Undefined index: update_success in update_results_page() (line 177 of /var/www/tmgmt/update.php).
Warning: array_pop() [function.array-pop]: The argument should be an array in update_results_page() (line 181 of /var/www/tmgmt/update.php).

When saving a task item (not save as complete) I get

•Notice: Trying to get property of non-object in tmgmt_local_task_form() (line 48 of /var/www/tmgmt/sites/all/modules/tmgmt/translators/tmgmt_local/includes/tmgmt_local.pages.inc).
•Notice: Trying to get property of non-object in tmgmt_local_task_form() (line 48 of /var/www/tmgmt/sites/all/modules/tmgmt/translators/tmgmt_local/includes/tmgmt_local.pages.inc).

The labels of the task items do NOT show.

When choosing one of the items, I get:
Fatal error: Call to a member function getJob() on a non-object in /var/www/tmgmt/sites/all/modules/tmgmt/translators/tmgmt_local/includes/tmgmt_local.pages.inc on line 138

And now I am blocked.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new2.82 KB
new214.6 KB

Fixed the typo in the tests and added hooks to delete tasks and task items when jobs are deleted. Your errors are related to that I think but I can't fix existing data inconsistencies.

berdir’s picture

Status: Needs review » Fixed

Decided to go ahead and commited it. It's not perfect but I think it's a huge improvement and the local translator starts to get actually usable with this. We can deal with bugs in follow-ups.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.