mirror of
https://gitea.invidious.io/iv-org/shard-athena-negotiation.git
synced 2024-08-15 00:53:23 +00:00
Fix Typos + Spell Check CI (#222)
* Add spellcheck CI job and fix existing typos * Add spec to bug caused by typo
This commit is contained in:
parent
74ef3ff387
commit
67d966e702
2 changed files with 6 additions and 6 deletions
|
@ -86,7 +86,7 @@ struct NegotiatorTest < NegotiatorTestCase
|
|||
{php_pear_header, {"audio/midi"}, {"audio/midi", nil}},
|
||||
{"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", {"application/rss+xml"}, {"application/rss+xml", nil}},
|
||||
|
||||
# Case sensitiviy
|
||||
# Case sensitivity
|
||||
{"text/* ; q=0.3, TEXT/html ;Q=0.7, text/html ; level=1, texT/Html ;leVel = 2 ;q=0.4, */* ; q=0.5", {"text/html; level=2"}, {"text/html", {"level" => "2"}}},
|
||||
{"text/* ; q=0.3, text/html;Q=0.7, text/html ;level=1, text/html; level=2;q=0.4, */*;q=0.5", {"text/HTML; level=3"}, {"text/html", {"level" => "3"}}},
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class Athena::Negotiation::Negotiator < Athena::Negotiation::AbstractNegotiator(
|
|||
accept_sub_type = accept.sub_type
|
||||
priority_sub_type = priority.sub_type
|
||||
|
||||
intercection = accept.parameters.each_with_object({} of String => String) do |(k, v), params|
|
||||
intersection = accept.parameters.each_with_object({} of String => String) do |(k, v), params|
|
||||
priority.parameters.tap do |pp|
|
||||
params[k] = v if pp.has_key?(k) && pp[k] == v
|
||||
end
|
||||
|
@ -24,9 +24,9 @@ class Athena::Negotiation::Negotiator < Athena::Negotiation::AbstractNegotiator(
|
|||
if (
|
||||
(accept_type == "*" || type_equals) &&
|
||||
(accept_sub_type == "*" || sub_type_equals) &&
|
||||
intercection.size == accept.parameters.size
|
||||
intersection.size == accept.parameters.size
|
||||
)
|
||||
score = 100 * (type_equals ? 1 : 0) + 10 * (sub_type_equals ? 1 : 0) + intercection.size
|
||||
score = 100 * (type_equals ? 1 : 0) + 10 * (sub_type_equals ? 1 : 0) + intersection.size
|
||||
|
||||
return ANG::AcceptMatch.new accept.quality * priority.quality, score, index
|
||||
end
|
||||
|
@ -49,9 +49,9 @@ class Athena::Negotiation::Negotiator < Athena::Negotiation::AbstractNegotiator(
|
|||
if (
|
||||
(accept_sub_type == "*" || priority_sub_type == "*" || sub_type_equals) &&
|
||||
(accept_plus == "*" || priority_plus == '*' || plus_equals) &&
|
||||
intercection.size == accept.parameters.size
|
||||
intersection.size == accept.parameters.size
|
||||
)
|
||||
score = 100 * (type_equals ? 1 : 0) + 10 * (sub_type_equals ? 1 : 0) + (plus_equals ? 1 : 0) + intercection.size
|
||||
score = 100 * (type_equals ? 1 : 0) + 10 * (sub_type_equals ? 1 : 0) + (plus_equals ? 1 : 0) + intersection.size
|
||||
return ANG::AcceptMatch.new accept.quality * priority.quality, score, index
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue