FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
13 stars 17 forks source link

participant.formatted_string() not documented & poorly named #239

Closed kuaka closed 3 years ago

kuaka commented 3 years ago

This function lacks a doc string and given it's complexity and name it is unclear what it does. I believe that it does not format a string but chops off words from the end of a string to bring it under the required length. suggest a name change and a doc string.

kuaka commented 3 years ago

I guess that the function of this has changed over time. I removed the capitalisation a few commits ago and the reduction in length is a new addition.

biuti commented 3 years ago

I pushed a documentation for the function. It is a new one, to trim long string under 100.

I don't really get why capitalising was removed. We will get a mix of any type from different sources without control. I think names written in the same way is preferable.

philderbeast commented 3 years ago

I don't really get why capitalising was removed. We will get a mix of any type from different sources without control. I think names written in the same way is preferable.

I, for one, prefer my surname spelt correctly as "de Joux" not mangled into "De Joux" or worse yet "Dejoux".

kuaka commented 3 years ago

Phil's answer sums it up.

We should not be changing names automatically. It would frustrate some people a lot that try to spell a name correctly and the system changes it to another format.

Off the top of my head I can't think of another website that automatically capitalises names. Normally your name is how you enter it.

There's also the issue where names/words with different capitalisation are not equal. Joe is not equal to joe. This brings up issues when trying to match tracks etc.

Capitalising doesn't guarantee the same format anyway. There's names like McDonald and if you capitalise mcdonald it's still not the same.

biuti commented 3 years ago

Generally a list like this: paolo rossi ANDREA BIANCHI Luigi DE ROSSI

is worse than Paolo Rossi Andrea Bianchi Luigi De Rossi

tracks are lower in any case. This way we rely on common sense, usually that does to work. PWCA capitalise name and makes uppercase surname. There would be cases where it's not perfect, like Phil's surname, still I think it is better than random.

Probably uppercase surname decided by PWCA has something to do with von, van, de, or anything else that should not be capitalise like McDonald.

kuaka commented 3 years ago

let's not complicate things. a list like this was entered by someone and that is where the responsibility should lie. (just like any other piece of software that I can think of) It should not be up to airscore to 'determine' how a name should be spelled.

paolo rossi ANDREA BIANCHI Luigi DE ROSSI

kuaka commented 3 years ago

at the end of the day @biuti it is up to you. I thought I was being helpful by addressing an easy fix of one of the many issues that have been logged to take a bit of the load of you. I'll close the issue since the original issue has been resolved (although I still think 'formatted string' is an odd choice for a formula name). Even with the issue closed you can still comment etc.

biuti commented 3 years ago

I did not realize about the name of function. At the moment it just trims string length. What name would you suggest? trimmed_string_length?

kuaka commented 3 years ago

I don't know :) normally names are imperative and don't involve types. e.g. print() as opposed to printed_string(). You want something that gives a hint of what it is doing. Perhaps something like abbreviate() or trim_abbreviate() or abbreviate_trim()