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

Complete polygon loader language list #1197

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

MaGaroo
Copy link
Contributor

@MaGaroo MaGaroo commented Nov 25, 2021

Hi!

There was a TODO in code about adding other language codes to polygon loader.

I found a list of languages in polygon and just added them to the loader dict.

However there are some concerns:

  1. Is there a cleaner approach compared to letting a big constant dictionary be in the middle of code?
  2. What language code to choose for "other"? Current choice is blank string.

Regards

@codecov
Copy link

codecov bot commented Nov 25, 2021

Codecov Report

Merging #1197 (2f2aa50) into master (1621394) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1197      +/-   ##
==========================================
- Coverage   63.66%   63.63%   -0.03%     
==========================================
  Files         233      233              
  Lines       17151    17151              
==========================================
- Hits        10919    10914       -5     
- Misses       6232     6237       +5     
Flag Coverage Δ
functionaltests 47.48% <0.00%> (-0.04%) ⬇️
unittests 43.98% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmscontrib/loaders/polygon.py 18.75% <100.00%> (ø)
cms/io/rpc.py 92.33% <0.00%> (-2.34%) ⬇️
cms/service/ScoringService.py 66.66% <0.00%> (-1.52%) ⬇️
cms/server/contest/phase_management.py 96.42% <0.00%> (-1.20%) ⬇️
cms/server/contest/handlers/contest.py 87.37% <0.00%> (-0.98%) ⬇️
cms/db/fsobject.py 76.51% <0.00%> (-0.76%) ⬇️
cms/db/util.py 52.59% <0.00%> (-0.75%) ⬇️
cms/grading/Sandbox.py 69.40% <0.00%> (-0.35%) ⬇️
cms/server/admin/handlers/base.py 68.97% <0.00%> (-0.34%) ⬇️
cms/db/base.py 87.12% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1621394...2f2aa50. Read the comment docs.

@andreyv
Copy link
Member

andreyv commented Dec 5, 2021

Hi,

Thanks for the improvement :)

  1. Good question. I was looking at Babel documentation, and it doesn't seem to provide a straightforward way to convert a language name in English to a language code. The other direction is possible through Locale.english_name.
    Anyway, unless the code is changed to glob statements/.pdf/*/problem.pdf instead of trying all languages, the custom list is needed either way to know languages supported by Polygon. So, I think, leaving the list as is is fine too.
  2. The empty language name creates some artifacts in CWS when multiple statements are added (it is not possible to select it from the sidebar etc.). Another possible choice is literally mapping other to Other, which is allowed too. EDIT: RFC 3066 also specifies the reserved x tag, which is theoretically applicable here, but Babel doesn't recognize it either.

@andreyv andreyv force-pushed the complete-polygon-langs branch from 8b4dafa to 2f2aa50 Compare December 20, 2021 19:05
@andreyv
Copy link
Member

andreyv commented Dec 20, 2021

I applied the above suggestion about other language. Code looks good, merging.

@andreyv andreyv merged commit 0401c53 into cms-dev:master Dec 20, 2021
RezwanArefin01 pushed a commit to RezwanArefin01/cms that referenced this pull request Dec 27, 2021
kevinsogo pushed a commit to kevinsogo/cms that referenced this pull request Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants