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

Update generate_template function and add UI for incomplete file #636

Closed
wants to merge 23 commits into from

Conversation

ulyssear
Copy link
Contributor

@ulyssear ulyssear commented Oct 23, 2022

What GitHub issue does this PR apply to?

Resolves #635

What changed and why?

  • New command generate_missing_templates which generates all missing thesaurus.

    python manage.py generate_missing_templates
  • New function in the Language model named is_incomplete.

    def is_incomplete(self, version, structure_key):
       """
       Returns a Boolean if the version is incomplete
    
       :param version: the version of the language
       :param structure_key: the ID for the structure to load
       :return: Boolean if the version is incomplete
       """
    
       template = self.load_filled_concepts(structure_key, version)
       template = json.loads(template)
       
       for concept in template["concepts"].values():
           code = concept.get("code")
           not_implemented = concept.get("not-implemented", None)
           comment = concept.get("comment", None)
           if isinstance(code, list):
               code = "".join(code)
           if isinstance(code, str) and code.strip() == "" and not_implemented is None and comment is None:
               return True
    
       return False

(If editing Django app) Please add screenshots

image

Checklist

  • I claimed any associated issue(s) and they are not someone else's
  • I have looked at the documentation to ensure I made any revisions correctly
  • I tested my changes locally to ensure they work
  • (If editing Django) I have added or edited any appropriate unit tests for my changes

Any additional comments or things to be aware of while reviewing?

@ulyssear
Copy link
Contributor Author

ulyssear commented Oct 23, 2022

I'm working on unit tests, but I have no idea how I could add draft mode inside the tests.
Would it be possible to have a track of what I could put?

@ulyssear ulyssear marked this pull request as ready for review October 23, 2022 16:04
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 October 29, 2022 15:01 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 October 29, 2022 15:04 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 October 29, 2022 16:02 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 October 30, 2022 16:42 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 October 30, 2022 18:51 Inactive
@ulyssear ulyssear changed the title Added Draft mode Update generate_template function and add UI for incomplete file Oct 30, 2022
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 November 10, 2022 04:24 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 November 14, 2022 02:53 Inactive
Copy link
Member

@geekygirlsarah geekygirlsarah left a comment

Choose a reason for hiding this comment

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

So besides the two comments, when I go to the review app, I don't see the UI addition. Shouldn't I see it here?

image

@@ -3,7 +3,7 @@
from web.models import MetaInfo


def generate_language_template(language_id, structure_id, version=None):
def generate_language_template(language_id, structure_id, version=None, draft=False):
Copy link
Member

Choose a reason for hiding this comment

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

Should this get removed as I think we decided against "draft mode"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to remove it, sorry for that.

Comment on lines 24 to 25
if draft:
meta['draft'] = True
Copy link
Member

Choose a reason for hiding this comment

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

Same for removing this

@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 November 14, 2022 11:55 Inactive
@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 November 14, 2022 11:56 Inactive
@ulyssear
Copy link
Contributor Author

ulyssear commented Nov 15, 2022

So besides the two comments, when I go to the review app, I don't see the UI addition. Shouldn't I see it here?

image

OK, I know what's happened: the method "is_incomplete" checks if the code fields are empty in the template inside the thesaurus folder. But in the case of some files, these entries (with "Unknown") are not present and thus, no condition is done there (so, the result will be False, instead of True).
We have to check with the complete template but I don't know if it's a good practice, I will even so put this solution.

@geekygirlsarah geekygirlsarah temporarily deployed to codethesaurus-test-pr-636 November 15, 2022 09:53 Inactive
@geekygirlsarah
Copy link
Member

I'm going to go ahead and close this because there's some merge conflicts and I haven't seen activity since November.

If you want to keep working on it, you're welcome to! You can reopen this or make a new pull request to keep working on it.

Thanks for the work you've put into it so far!

@ulyssear
Copy link
Contributor Author

I'll check on my side to fix the merge conflicts !
I may do this this week, or next week at the latest.

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

Successfully merging this pull request may close these issues.

Update generate_template function and add UI for incomplete file
2 participants