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

Fix: make sure getting the coordinates from the page/summary endpoint #4311

Merged
merged 4 commits into from
Dec 4, 2023

Conversation

cooltey
Copy link
Collaborator

@cooltey cooltey commented Nov 30, 2023

When checking the page/summary endpoint, you will notice the coordinates are from coordinates attribute instead of geo; it looks like it has broken for a while.
https://en.wikipedia.org/api/rest_v1/page/summary/Lake_Natoma

This PR also fixes the incorrect HTML title shown on the map that is sent from the app.

TODO:
The test will fail if the Location is not null. Cannot find the root cause between the PageSummary and PageProperties. Will discuss this in the engineers' sync.

@cooltey cooltey added the High Priority Priority code review needed label Nov 30, 2023
@cooltey
Copy link
Collaborator Author

cooltey commented Dec 1, 2023

Test result:

Expected: is <PageProperties(pageId=19004, namespace=MAIN, revisionId=1015030565, lastModified=Tue Mar 30 01:43:22 PDT 2021, displayTitle=Moscow, editProtectionStatus=, isMainPage=false, leadImageUrl=https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Spasskaya_Tower_and_the_St._Basil%27s_Cathedral.jpg/640px-Spasskaya_Tower_and_the_St._Basil%27s_Cathedral.jpg, leadImageName=Spasskaya_Tower_and_the_St._Basil's_Cathedral.jpg, leadImageWidth=320, leadImageHeight=242, geo=Location[ 55.755833,37.617222 acc=??? t=?!? et=?!?], wikiBaseItem=Q649, descriptionSource=local, canEdit=false)>
     but: was <PageProperties(pageId=19004, namespace=MAIN, revisionId=1015030565, lastModified=Tue Mar 30 01:43:22 PDT 2021, displayTitle=Moscow, editProtectionStatus=, isMainPage=false, leadImageUrl=https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Spasskaya_Tower_and_the_St._Basil%27s_Cathedral.jpg/640px-Spasskaya_Tower_and_the_St._Basil%27s_Cathedral.jpg, leadImageName=Spasskaya_Tower_and_the_St._Basil's_Cathedral.jpg, leadImageWidth=320, leadImageHeight=242, geo=Location[ 55.755833,37.617222 acc=??? t=?!? et=?!?], wikiBaseItem=Q649, descriptionSource=local, canEdit=false)>

The result is the same as the expected one.

@@ -41,6 +41,8 @@ class ParcelableTest {
fun testPagePropertiesFromSummary() {
val json = TestFileUtil.readRawFile("rb_page_summary_geo.json")
val summary = JsonUtil.decodeFromString<PageSummary>(json)!!
// FIXME: somehow the Location object is different even though the values are the same. Set null to bypass the test temporary
Copy link
Member

Choose a reason for hiding this comment

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

This test fails because the PageProperties class contains a Location field, which is not a primitive type. If you parcel and then unparcel a PageProperties object, the actual instance of the Location field will be different in the unparcelled object than the parcelled object.

The issue is really that the test isn't smart enough to perform a "deep-equal" between the two objects, and instead it's just comparing the literal instances.

I'm actually not sure I see the point of these tests anyway. We're testing whether Parcelable objects can be parcelled and unparcelled... Are we testing whether the Android SDK works? Whether the Java language works? What exactly could fail here?
Anyway, I think the fix in this PR is good to merge.

@dbrant dbrant merged commit 4d5d038 into main Dec 4, 2023
1 check passed
@dbrant dbrant deleted the fix-summary-geo branch December 4, 2023 19:09
cooltey added a commit that referenced this pull request Dec 6, 2023
…esign

* origin/nearby_design:
  Bump versionCode. (#4318)
  Further fix video playback! (#4317)
  Bump versionCode. (#4316)
  Fix: make sure getting the coordinates from the page/summary endpoint (#4311)
  Fix playback of videos in Gallery. (#4313)
  Fix strings.
  Localisation updates from https://translatewiki.net.
  Revert "Fix playback of videos."
  Fix playback of videos.
  Fix: scrolling issue in the AddTemplateActivity (#4312)
  Localisation updates from https://translatewiki.net. (#4310)
  Update maplibre versions (#4306)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority Priority code review needed
Development

Successfully merging this pull request may close these issues.

2 participants