Skip to content

Splitting SubmissionType into SubmissionSource and SubmissionAction

Taras Semenenko edited this page May 31, 2016 · 2 revisions

SubmissionType

#: These are the values for the 'type' field of Submission
class SubmissionTypes(object):
    # None/0 = no information
    NORMAL = 1        # Interactive web editing
    REVERT = 2        # Revert action on the web
    SUGG_ACCEPT = 3   # Accepting a suggestion
    UPLOAD = 4        # Uploading an offline file
    SYSTEM = 5        # Batch actions performed offline
    MUTE_CHECK = 6    # Mute QualityCheck
    UNMUTE_CHECK = 7  # Unmute QualityCheck
    SUGG_ADD = 8      # Add new Suggestion
    SUGG_REJECT = 9   # Reject Suggestion
    UNIT_CREATE = 10  # Create a Unit with translation

There is a mess because different origin of data is kept here. So we need to separate SubmissionSource and SubmissionAction.

SubmissionSource

class SubmissionSources(object):
    WEB = 1  # Interactive web editing
    UPLOAD = 3  # Uploading an offline file
    SYSTEM = 4  # Batch actions performed offline

What action values should be?

We can just keep the rest of types here.

#: These are the values for the 'action' field of Submission
class SubmissionActions(object):
    # None/0 = no information
    SUGG_ACCEPT = 3  # Accepting a suggestion
    MUTE_CHECK = 6  # Mute QualityCheck
    UNMUTE_CHECK = 7  # Unmute QualityCheck
    SUGG_ADD = 8  # Add new Suggestion
    SUGG_REJECT = 9  # Reject Suggestion
    UNIT_CREATE = 10  # Create a Unit with translation

But ideally I'd like to proceed further. Currently we create 2 submissions when submission action affects two fields target and state. So we have to care about picking such pairs of submissions to build a proper timeline. I'd suggest to match all possible pair to one action field.

How state and target fields can be changed together?

0 -> -100 (target can’t be changed here)
0 -> 50 (target must be changed here)
0 -> 200 (target must be changed here)

50 -> -100 (target can't be changed here)
50 -> 0 (target is set to empty)
50 -> 200 (target can be changed here)

200 -> 50 (target can be changed here)
200 -> 0 (target is set to empty)
200 -> -100 (target can't be changed here)

-100 -> 0 (target can be changed here)
-100 -> 50 (target can be changed here)
-100 -> 200 (target can be changed here)

These are situations when both fields can be changed:

  • removing needs work and changing translation;

  • adding need work and changing translation;

  • resurrecting without translation;

  • resurrecting with fuzzy translation;

  • resurrecting with translation;

Full list of submission actions can look as following:

#: These are the values for the 'action' field of Submission
class SubmissionActions(object):
    # None/0 = no information
    CREATED_WITH_TRANSLATION = 1  # Create a Unit with translation
    TRANSLATE = 2  # Add a new translation (state is changed: `0 -> 200`)
    EDIT_TRANLATION = 3  # Edit target field
    PRE_TRANSLATE = 4  # Add a new translation (state is changed: `0 -> 50`)
    REMOVE_TRANSLATION = 5  # Set target to empty string (state: `200 -> 0`)
    REMOVE_FUZZY_TRANSLATION = 6  # Set target to empty string (state: `50 -> 0`)
    REVIEW = 7  # state: `50 -> 200`
    (REVIEW_AND_EDIT_TRANSLATION = 8  # state: `50 -> 200`,
    #resurrecting without translation;
    #resurrecting with fuzzy translation;
    #resurrecting with translation)?
    SET_NEEDS_WORK = 9  # state: `200 -> 50` (only admins can do it, not sure if target can be changed here)
    SUGG_ADD = 10  # Add new Suggestion
    SUGG_ACCEPT = 11  # Accepting a suggestion
    SUGG_REJECT = 12  # Reject Suggestion
    MUTE_CHECK = 13  # Mute QualityCheck
    UNMUTE_CHECK = 14  # Unmute QualityCheck
    ADD_COMMENT = 15
Clone this wiki locally