stadust / pointercrate

Rewrite of the https://pointercrate.com backend in Rust
MIT License
78 stars 50 forks source link

Additional political subdivisions #91

Closed ArkaneOnline closed 4 months ago

ArkaneOnline commented 8 months ago

There's probably some more stuff that needs to be done in order to get the fully working, but I have no clue what steps to take after this point.

From exsii: Note: China has most of it's flags set as placeholder question marks due to these subdivisions legally not being allowed to have their own flags. Might be changed to flags showing the region borders (like the flag of Sakhalin Oblast, Russia https://en.wikipedia.org/wiki/File:Flag_of_Sakhalin_Oblast.svg)

Also the following subdivisions didn't have .svg files for flags/emblems/coats of arms so they had png images added into .svg files:

Portugal: 14, 15 Romania: bz, cs, ct, if, mh, ot, sb, sm, sv, tm Philippines: 01, 02, 03, 05, 06, 07, 08, 09, 11, 12, 13, 15, 41

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 21.76%. Comparing base (c2afbc6) to head (84ff75f). Report is 6 commits behind head on master.

:exclamation: Current head 84ff75f differs from pull request most recent head c69baa5. Consider uploading reports for the commit c69baa5 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #91 +/- ## ========================================== - Coverage 21.78% 21.76% -0.03% ========================================== Files 111 111 Lines 8304 8304 ========================================== - Hits 1809 1807 -2 - Misses 6495 6497 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ArkaneOnline commented 8 months ago

Also, if you need a list of subdivisions, we can provide you with that. If you would need a specific format as well let us know!

stadust commented 8 months ago

oh boy, I'll need to remember how this entire subsystem works in the first place :joy: There is definitely a database aspect to this, e.g. see https://github.com/stadust/pointercrate/blob/master/migrations/20210419002933_nationalityupdate.up.sql. A similar migration would be needed that alters the static table with support for everything added in this PR. Then, inside the SVG file the hierarchy of elements (nesting + CSS class names) needs to match what's expected in https://github.com/stadust/pointercrate/blob/master/pointercrate-demonlist-pages/static/js/modules/statsviewer.js#L153 (again, I dont exactly remember what that is, and it seems I didnt write down comments either. I might have time to look at this in a few weeks if you need help, though). Lastly, and this is arguably the biggest problem, is that the file size is now 2.4MB. Even with compression, that's too large for it to load at a reasonable time. There's a few things we can do about this luckily:

Also, where did y'all grab those flags from? What's the license on those?

exsii commented 8 months ago

when making the map i looked at the format of hierarchy of elements in countries with existing subdivisions, including all the css classes; tested the map a bunch, works good all flags are taken straight from wikipedia (just like flags of subdivisions in us and canada) ill try to see what i can do with shrinking the world map file later

exsii commented 5 months ago

i cleaned up all the flags, tell me how to attach the migration with new subdivisions to the repo tho

stadust commented 5 months ago

Mhh, some of these are over 1MB large

1010029 ./mx/nay.svg
1358046 ./mx/oax.svg
2018077 ./mx/cam.svg
2061860 ./mx/chp.svg
2196399 ./ru/kda.svg
3408590 ./mx/mex.svg
4137113 ./mx/tab.svg

and quite a few more are between 100KB and 1M:

``` 102588 ./pe/apu.svg 105126 ./bt.svg 105943 ./cl/an.svg 108675 ./ar/w.svg 109215 ./it/36.svg 110081 ./fr/bfc.svg 110273 ./es/cn.svg 112293 ./br/rn.svg 115557 ./ru/vlg.svg 119662 ./it/82.svg 124849 ./us/ny.svg 125329 ./mx/son.svg 125507 ./va.svg 126135 ./ru/kya.svg 126583 ./ru/alt.svg 127132 ./ru/ast.svg 127996 ./us/ct.svg 128314 ./nl/ze.svg 129164 ./us/mi.svg 129383 ./us/or.svg 130185 ./cl/vs.svg 132936 ./ru/tam.svg 133243 ./us/ok.svg 136484 ./af.svg 139551 ./mx.svg 144208 ./ua/09.svg 148958 ./ht.svg 151850 ./ar/d.svg 152788 ./ua/23.svg 155319 ./es/an.svg 156768 ./me.svg 161722 ./es/na.svg 169941 ./us/ia.svg 171052 ./fi/17.svg 174055 ./ru/bel.svg 182222 ./ru/mow.svg 182839 ./es/ml.svg 184443 ./fr/pm.svg 191403 ./es/cb.svg 191790 ./de/sl.svg 192162 ./ru/kem.svg 200057 ./ru/sam.svg 200863 ./cl/ta.svg 203618 ./do.svg 208156 ./br/rs.svg 208425 ./us/mt.svg 213055 ./pe/ica.svg 213690 ./ru/kos.svg 214427 ./pe/moq.svg 215169 ./pe/lor.svg 218115 ./mx/nle.svg 222120 ./mx/coa.svg 224031 ./ru/mos.svg 226203 ./pm.svg 226282 ./us/ks.svg 229518 ./us/la.svg 231180 ./us/ma.svg 232549 ./us/wv.svg 237928 ./ru/krs.svg 242933 ./us/ky.svg 252167 ./us/de.svg 256270 ./us/il.svg 257491 ./us/wa.svg 260129 ./ru/pnz.svg 264595 ./pe/anc.svg 267300 ./ru/sta.svg 271952 ./ua/32.svg 272103 ./us/nh.svg 272245 ./br/al.svg 272830 ./ru/sar.svg 274927 ./pe/tac.svg 275061 ./ru/spe.svg 275167 ./mx/pue.svg 277420 ./bl.svg 280714 ./sv.svg 280798 ./it/62.svg 281322 ./ua/71.svg 283815 ./us/mo.svg 286360 ./mx/gua.svg 295836 ./pe/ama.svg 301620 ./ar/c.svg 307461 ./mx/chh.svg 309058 ./mx/que.svg 319778 ./mx/dur.svg 321336 ./ua/48.svg 323160 ./pe/caj.svg 330890 ./us/nd.svg 337407 ./us/ne.svg 338906 ./us/nj.svg 343365 ./pl/18.svg 349627 ./ua/12.svg 351718 ./br/rj.svg 360017 ./mx/tam.svg 374021 ./us/ca.svg 388039 ./pe/are.svg 395130 ./ru/ark.svg 406190 ./us/wi.svg 420428 ./ru/tom.svg 426200 ./ar/m.svg 429877 ./us/vt.svg 430713 ./mx/mic.svg 444218 ./ru/iva.svg 448365 ./ua/05.svg 450758 ./us/me.svg 463282 ./us/id.svg 473359 ./mx/agu.svg 473731 ./mx/sin.svg 481385 ./ru/ore.svg 486950 ./mx/col.svg 490057 ./pe/uca.svg 492022 ./ru/orl.svg 525719 ./us/va.svg 554734 ./us/sd.svg 563574 ./br/pr.svg 613819 ./us/fl.svg 733617 ./mx/hid.svg 752810 ./mx/ver.svg 755184 ./pe/sam.svg 775498 ./us/pa.svg 803407 ./mx/zac.svg 809356 ./ca/pe.svg 883936 ./rs.svg 884544 ./mx/slp.svg 989742 ./mx/cmx.svg ```

The >1M ones we definitely need to do something about, but even the >100KB ones seem excessively large to me :thinking:

stadust commented 5 months ago

This seems to break the highlighting of the currently selected country/subdivision. E.g. on pointercrate.com, selecting US state montana look like this

image

(note the dark blue to indicate its selected), while with this PR is looks as follows:

image

(e.g. no highlighting). This is broken for both countries and subdivisions (both ones that existed before this PR as well as the new ones) :(

exsii commented 5 months ago

ill look into the world map more again idk why this would break at all, considering i literally have formatted everything the exact same way as existing countries

exsii commented 5 months ago

also regarding the flags and flag sources thats true, ill do that tomorrow

exsii commented 5 months ago

nvm i fixed it somehow, inkscape messed up the formatting in the section with the main style apparently, if i format it correctly it works? ill fix everything tomorrow as said before

exsii commented 4 months ago

should be good now...