Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesse Andrews 191 posts 716 karma points c-trib
    Jun 27, 2019 @ 00:13
    Jesse Andrews
    0

    How is a job moved from "submitted" to "received?"

    Currently I have a custom provider that successfully reaches the submitted stage. I'm running into issues transitioning it to the Received stage though. Currently I'm editing the status of the job and the nodes and saving the changes with the jobService. I manually updating the node status

    foreach (var node in job.Nodes) {
        node.Status = NodeStatus.Reviewing;
        ...
    }
    

    and then save the changes.

    job.Status = JobStatus.Received;
    _jobService.Save(job);
    _jobService.UpdateJobAndNodeStatus(job);
    

    where _jobService is a reference to the translation manager job service. I originally had just _jobService.Save. That updated the job status, but not the node status, so I wasn't able to review the nodes in order to approve them.

    Is this the correct approach and I'm just missing something, or is this supposed to be run through the Check method on the provider?

    I'm not using the Check method currently, as the transition is started by an api callback passed to the external translation service, to minimize the risk of hitting api rate limits. I can add support for that check method in a way that avoids that without too much trouble, but I want to clarify what it's supposed to do before diving into that.

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Jun 27, 2019 @ 08:42
    Kevin Jump
    100

    Hi

    The short answer is you don't need to change the node or job status as part of the provider - instead set the 'Translated' value on all Translation Values in the nodes/job to True and the job will move to Received as part of the process.

    If you are using a callback and not going via check you should be able to use ReturnJob(TranslationJob job) on the TranslationJobService as this will call the UpdateJobAndNodeStatus method which checks the status and it will also fire the received event, so things like notifications still work. (I say should I am not actually sure if we have a live provider using this method at the moment, but we do have the code there)

    A longer answer:

    After a job is checked and the translation provider returns success - the main translation service call will check the status of the translation nodes/values to determine the status of the job.

    This is done by recursing into all nodes and then translation values to look at the Translated boolean value on all TranslationValues in a node's target property (only nodes with no child values have to have this value set to true)

    if all values in a node have Translated = true, that node is set to 'Reviewing'

    if all nodes in a job are set to reviewing the job is set to Received
    if only some of the nodes are set to Reviewing the job is set to Partial.

  • Jesse Andrews 191 posts 716 karma points c-trib
    Jun 28, 2019 @ 00:26
    Jesse Andrews
    0

    Thanks for the clarification Kevin. That did the trick for me.

Please Sign in or register to post replies

Write your reply to:

Draft