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

Wrong dates added for non-English locales #3126

Closed
VojtechDostal opened this issue Aug 12, 2019 · 54 comments · Fixed by #3155 or #3226
Closed

Wrong dates added for non-English locales #3126

VojtechDostal opened this issue Aug 12, 2019 · 54 comments · Fixed by #3155 or #3226

Comments

@VojtechDostal
Copy link
Collaborator

I uploaded a few pictures a few days ago using the latest version of the app. An automatic category to sort the pictures by date was added to each of them, which is cool, but the category does not exist:

See eg:
https://commons.wikimedia.org/wiki/File:Krucifix_na_z%C3%A1pad_od_Zl%C3%AD%C4%8Dka.jpg

Also the app thinks I uploaded them on 10th August 2020 rather then 2019... could that be a problem with my phone, though?

@misaochan
Copy link
Member

misaochan commented Aug 12, 2019

Hmm, I've just tested the alpha and found no issue with the date taken - https://commons.wikimedia.org/wiki/File:San_Gimignano_2.jpg . The hidden category https://commons.wikimedia.org/wiki/Category:Photographs_taken_on_2019-07-05 does exist for me - I suspect the reason it doesn't exist for you is because the date is in 2020. :)

Is anyone else able to reproduce this? Vojtech does your phone display the current date correctly to you (aside from this app)?

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Aug 13, 2019

Do we really need this date category?
Maybe the bug is that the date format varies with the locale?

@misaochan
Copy link
Member

I don't think the category was made by us, it seems to be added to Upload Wizard uploads too, i.e. https://commons.wikimedia.org/wiki/File:Kirkkokatu_27_Raahe_20190705.jpg

@nicolas-raoul
Copy link
Member

Then the easiest is probably to create a Phabricator ticket and forget about it :-)

@misaochan
Copy link
Member

I don't think the problem is with the category creation though... it seems to be a side effect of the wrong upload date. It makes sense for uploads made "in the future" to not have the category created yet.

@nicolas-raoul
Copy link
Member

A few examples found:

  • Photographs taken on 10. 08. 20 (Czech locale)
  • Photographs taken on 27/08/2019 (Nepali locale)
  • Photographs taken on 2019-07-05 (English locale) ← Only this one is valid

So, instead of writing the date using the user's locale, we should code it explicitly as year + "-" + month + "-" + day.

@misaochan
Copy link
Member

misaochan commented Aug 28, 2019

@nicolas-raoul , is this the same issue as the one reported in our public forum? If so (and the dates are indeed wrong for all non-English locales), we should prioritize this fix since it's a big problem.

Wrong dates appear in the files description pages due to the application
Example of correction:
https://commons.wikimedia.org/w/index.php?title=File:The_Donkey_Tail_Plant.jpg&diff=prev&oldid=363578552&diffmode=source

@nicolas-raoul
Copy link
Member

@misaochan Yes, I am pretty sure it is, and I share your view that it is a priority issue, because it forces Commons people to fix our mess, giving the app a bad reputation.

@misaochan
Copy link
Member

misaochan commented Aug 29, 2019

@nicolas-raoul Agreed. Unfortunately I am away for 2 weeks starting this Saturday, and by the time I get back 2.12 should be close to ready, which means that a hotfix may not make sense. :/ Or alternatively, could you and @ashishkumar468 collaborate on this, where he sends a hotfix to our 2.11-release branch, and you do the 2.11.1 hotfix release when it is ready? You'd just need to release the 2.11-release branch with the addition of his PR, don't take anything from master.

@misaochan misaochan changed the title Automatic "taken on" categories do not exist Wrong dates added for non-English locales Aug 29, 2019
@nicolas-raoul
Copy link
Member

I am looking for a new apartment right now so I have to focus on that, unfortunately :'-/ But I can review a pull request :-)

@misaochan
Copy link
Member

Ah, okay. I'll try to release 2.11.1 with the hotfix as soon as I get back, then.

@ashishkumar468
Copy link
Collaborator

I will look into the issue and raise a PR for the same :)

@ashishkumar468
Copy link
Collaborator

I am not able to reproduce this, I can see the actual date for both Hindi & English Locales. Is there a specific way to produce this ?

@nicolas-raoul
Copy link
Member

nicolas-raoul commented Sep 3, 2019

@ashishkumar0207
Maybe Hindi & English locales use the same date format.
Would you mind trying Czech or Nepali locale?

@ashishkumar468
Copy link
Collaborator

@nicolas-raoul Sure, I will try that .

@VojtechDostal
Copy link
Collaborator Author

It seems this is a fairly general phenomenon... just found out the same bug appears in pictures from another Czech uploader: https://commons.wikimedia.org/wiki/File:Plastika_Prost%C5%99en%C3%BD_st%C5%AFl_v_ulici_Na_Mlejnku.jpg

So it could really be due to language settings.

@PavelAplevich
Copy link
Contributor

I can't reply this bug with my phone, with Czech, Nepali, English or Russian locale.

@nicolas-raoul
Copy link
Member

@PavelAplevich Thanks for trying! Could you please post the URL to the images you uploaded in each locale? Thanks :-)

@PavelAplevich
Copy link
Contributor

https://commons.wikimedia.beta.wmflabs.org/wiki/File%3AMemori%C3%A1l.jpg
This image upload now. But on "Summary" i see "6 August 2019"

@PavelAplevich
Copy link
Contributor

@nicolas-raoul Thank you, for pictures.
I think, the problem is:
Photos with correct date i download from my messenger. They date based on date of creating file.
Photos with wrong date i did it by myself, on my phone. They date based on EXIF.
As the result - EXIF work's wrong.
What do think about this?

@Aschroet
Copy link

There is one line where the template is filled:

return String.format(Locale.ENGLISH, TEMPLATE_DATE_ACC_TO_EXIF, DateUtil.getDateStringWithSkeletonPattern(dateCreated, "yyyy-MM-dd")) + "\n";

Either dateCreated is not in the correct format or the formatter getDateStringWithSkeletonPattern does not work properly.

@misaochan
Copy link
Member

@PavelAplevich Using EXIF data is fine as far as I'm aware. The problem here is with the date templates being sent, which are in the wrong format. I think #3126 (comment) explains what needs to be done. :)

@misaochan
Copy link
Member

@PavelAplevich would you happen to have an update on this? Sorry for the rush, but this is a bit of a high-priority issue. :)

@PavelAplevich
Copy link
Contributor

PavelAplevich commented Sep 26, 2019

@misaochan
Copy link
Member

misaochan commented Sep 27, 2019

@PavelAplevich none of them are correct. We need the format "2019-07-05", which has the year first.

Take a look at the template for the images you linked - to view the format of the template, you can go to Summary > edit. The first file you linked, for instance, says:

== {{int:filedesc}} ==
{{Information
|description={{cs|1=test}}
|source={{own}}
|author=[[User:Roc|Roc]]
|date={{According to EXIF data|13. 03. 2019}}
}}

A possible solution is to code it explicitly as year + "-" + month + "-" + day.

PavelAplevich added a commit to PavelAplevich/apps-android-commons that referenced this issue Sep 28, 2019
ashishkumar468 pushed a commit that referenced this issue Sep 29, 2019
Fixed wrong upload dates after image upload
@ashishkumar468
Copy link
Collaborator

Thanks for the PR @PavelAplevich , the same is merged with master, works for me. Can someone else also verify the same ?

@misaochan
Copy link
Member

Thanks so much @PavelAplevich ! :) @ashishkumar468 I am trying to review the results, but it seems like the Commons Beta DB is down at the moment? I'll try again later.

@misaochan
Copy link
Member

Issue is fixed for me. Thanks @PavelAplevich !

misaochan pushed a commit that referenced this issue Oct 3, 2019
Fixed wrong upload dates after image upload
@misaochan
Copy link
Member

misaochan commented Oct 3, 2019

With further testing, I've found that uploaded pictures without EXIF data don't display the date at all in the summary: https://commons.wikimedia.org/wiki/File:Byron_lighthouse_2.jpg

This is quite strange since https://commons.wikimedia.beta.wmflabs.org/w/index.php?title=File:NoEXIF.jpg displays the date perfectly fine. And their date templates are exactly the same. I don't remember this happening in the previous versions.

Is there a difference between how Commons Beta and the real Commons handles display of date templates?

@misaochan misaochan reopened this Oct 3, 2019
@PavelAplevich
Copy link
Contributor

@misaochan
I see the correct information both there and there

@misaochan
Copy link
Member

Do you see the date in the summary? I don't mean Summary > Edit, but in the user-facing summary. Personally for https://commons.wikimedia.org/wiki/File:Byron_lighthouse_2.jpg this is what I see:

Description | English: Lighthouse at Cape Byron
Date |  
Source | Own work
Author | misaochan2

@PavelAplevich
Copy link
Contributor

Yes, i see.. Any ideas, what the problem is?

@misaochan
Copy link
Member

I'm not sure. :( Trying to figure it out myself too. @nicolas-raoul @Aschroet any idea?

@misaochan
Copy link
Member

misaochan commented Oct 10, 2019

@Achim55 Hope you don't mind a quick Q - do you know why the date field in the user-facing summary of https://commons.wikimedia.org/wiki/File:Byron_lighthouse_2.jpg is blank, even though the template is filled with |date={{date|2019-09-09}}?

@Yued1
Copy link

Yued1 commented Oct 11, 2019

@misaochan I tried in various locales, and the user-facing summary is displaying the proper dates. Perhaps you should try reloading your browser (or try reloading after clearing your cache).

@PavelAplevich
Copy link
Contributor

PavelAplevich commented Oct 11, 2019

@misaochan I see this date too.

Снимок экрана от 2019-10-11 07-26-18

@Achim55
Copy link

Achim55 commented Oct 11, 2019

I fixed it and left a note on your talk page. The behavior of {{date}} may differ on different projects.

In general the date field of file pages on Commons should not use the {{date}} template but be either
|date=yyyy-mm-dd
|date=yyyy-mm
|date=yyyy
or
|date={{According to EXIF data|yyyy-mm-dd}}
or for special cases like centuries
|date={{Other date|...some special data...}}

Best, Achim

maskaravivek pushed a commit that referenced this issue Oct 15, 2019
Fixed wrong upload dates after image upload
misaochan pushed a commit that referenced this issue Oct 16, 2019
Fixed wrong upload dates after image upload
@misaochan
Copy link
Member

Thanks @Achim55 , I'll modify the template that we send accordingly. :)

ashishkumar468 pushed a commit that referenced this issue Nov 6, 2019
* Migrated logEvents to retrofit (#3087)

* Switched wikimedia-android-data-client for new features

* Added UserCLient and UserInterface

* Migrated ContributionsSyncAdapter to UserClient
Fixed sync related bugs

* Removed unused code

* Removed unused code

* Updated wikimedia-android-data-client to new version

* Update library for data client (#3131)

* Backend overhaul fetch media by filename (#3081)

* Added class MwParseResponse and MwParseResult for receiving parse output

* Migrated fetchMediaByFilename to retrofit

* Removed unused code

* Added tests

* Migrated isUserBlockedFromCommons to retrofit (#3085)

* Switched wikimedia-android-data-client for new features

* Added UserCLient and UserInterface

* Migrated isUserBlockedFromCommons to retrofit

* Added tests and removed dead code

* Implemented ban checking functionality in UploadActivity

* Removed unused class AuthenticatedActivity

* Fixed tests

* Fixed NullPointerException when a user accessed image details without logging in.

* * Login the login token way, handle LoginResult minutely, add account based on LoginResult (#3151)

* Added progress updater in UploadService to show upload progress in no… (#3156)

* added progress updater in UploadService to show upload progress in notification

* formatting changes

* [Dependency: Quadtree] Remove unused code from cache controller (#3163)

* Basic logging with redacted sensitive headers (#3159)

* As per #3026, removed the obsolete classes in package mwapi (#3150)

* fixed compile time error (#3165)

* [Dependency fluent]: Remove unused dependency fluent (#3164)

* Donot init quiz checker in onResume (#3167)

* clear image cache on logout (#3168)

* Fixed default locale and upload locales in descrptions (#3166)

* Fix 2FA login (#3170)

* Fix build (#3172)

* Localisation updates from https://translatewiki.net.

* Closes #3094 (#3095)

* BugFix in SpinnerDescriptionsAdapter and SpinnerLanguagesAdapter (use the langguage code provided by the spinner, donot set the language to the one returned by the locale)

* Update changelog.md

* Versioning for v2.11.0

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Center map on location clicked in nearby list and notification card(#2060) (#2366)

* center map on location clicked in nearby (#2060)

* improved animation

* Center map on location clicked in nearby list

* removed unnecessary methods

* center map on location clicked in nearby notification card

* some minor changes

* travis build error

* resolved errors

* Tidy up PR

* removed swipe to delete (#2589)

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* edited CREDITS file (#3145)

* Unused dependencies are removed (#3141)

Part of #3128

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Working with #3129 issue (#3146)

* Replace Hard-Coded strings with those from strings.xml.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* delete res/values-en-gb (#3153)

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* First commit (#3093)

Fixes info icon color is Review

* Solution #3126 (#3155)

Fixed wrong upload dates after image upload

* Bugfix/fix upload presenter tests (#3158)

* Revert "Merge branch 'backend-overhaul' into master"

This reverts commit 0090f24, reversing
changes made to 9bccbfe.

* * Fixed upload presenter tests
* Deleted app/src/main/res/values-en-gb/error.xml

* Localisation updates from https://translatewiki.net.

* Remove dependency on Exif parsing library. (#2947)

* Remove dependency on Exif parsing library.

* Fix test.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Refactor nearby classes mvp (#2969)

* Create parent contract

* Create map child contract and fill methods

* Add javadocs and specific interfaces for list

* Move general method to parent and add javadocs for parent

* Add explanation for keeping an emty View interface under NearbyListContract

* Move constracts under contract package

* Create presenters for map and list and implement user actions accordingly

* Add javadocs

* Add presenter, contract and fragment for parent Fragment of both NearyListFragment and NearbyMapFragment

* Implement missing methods

* Fix typo

* Add main views on fragment

* İmplement child fragment logic and their retain

* Relate parent presenter with parent fragment

* Add all location permission related methods to view contract and implement in fragment. Call them from presenter by passing locationServiceManager parameter

* Define refreshView method as updateMapAndList which is a better naming. Define it at presenter part.

* Define a presenter variable in fragment and call updateMapAndList method from there, if permissions are okay

* Add lock neabry method to unlisten nearby operations during updates

* Add network connection established check on view side, check it from presenter

* try to simplify previous method during refactor

* Add missing methods for NearbyMap

* Connect child fragment and prent fragment with presenter

* Change nearby design, first create views then register listeners

* AddnetworkBroadcatsReceiver on view side, call it from presenter

* Add comments

* Change the old NearbyFragment by our new NearbyParentFragment for first tests

* Prevent crash caused child fragment is actually null by checking if it is attached or not.

* Makes sure that initialize nearby operations method is called just after all views and fragments are ready and attached

* Make sure updateMAoAndList method is called when everything ready

* Rename a method with prepoer name

* Call update map and add required markers

* Find out zoom level problem

* Implement add nearby markers and add current marker methods

* remove unneeded codes copied from previous implementation

* Revert "remove unneeded codes copied from previous implementation"

This reverts commit 4253965.

* add some commits and clear code

* Remove location listener implementation from view, handle them in presenter instead. And add timber debug notes and required method calls

* Style ,issues

* Refactor a variable name to camel case and bind search this area view

* Search this area button action is added

* Mostly implement search this area methods, not tested yet even once

* Make sure everything is called in required order and seach this area method basically works

* Rename methods accordingly and add Javadocs

* Add current location marker and remove circle around it

* Remove unused methods

* Add current location marker with object animator and remove previous marker is exists

* include clear map into add markers method and reorder methods

* Make search this area button appear at correct time

* Try to load un search this area is called

* Clear logs

* Add changes for permission made by Vivek to newly added fragments along with our nearby classes

* Add a view to nearby map ragment and insert map view as an item inside it

* Add logs to uınderstand why on meap ready callback is never called

* Add list item clicked and bottom sheet for list of nearby items is expanded

* Make nearby map ready callback came

* Add required methods to be called after map view is ready

* State: Map ready call is not called but permissions and methods are in correct order

* Remove unused logs

* Try to use SupportMapFragment instead, still no success...

* use SupportMapFragment instead

* Remove unused Near

* Upgrade mapbox sdk versions

* Remove Style import from fragment/NearbyMapFragment

* Remove Style import from **fragments/NearbyParentFragment

* Remove nearby/NearbyMapFragment

* Remove unused/old NearbyFragment and NearbyMapFragment

* Remove import of already removed class

* Make sure you removed everything related with mapbox implementation

* Update mapbox map

* Remove unused classes, do not forget centerMapToPlace doesn't work on this branch

* Remove Style class it required updated version of mapbox map

* Add base codes for new activity

* Prove that our mapbox sdk let us implement the map directly inside the activity

* Add base codes for testing mapbox activity in a single fragment inside activity

* Add codes from mapbox demo repository to test support fragment, map works in a single layer fragment

* Add base codes for test layered fragment activity

* Add Support fragment inside a fragment and proves that layered fragmentw with map works

* Test view pager and tab layout with support map fragment to see it works, it works!

* Move Contributions Fragment related codes to test activity

* Move nearby card methods

* Inject location manager and implement NerabyParentFragmentContract.View on test fragment

* Coppy the content of SupportMapFragment from mapbox repository, use this code to modify later. This method war suggested by mapbox team instead of extending the class

* Implement NearbyMapContract.View on our new SupportMapFragment

* Start to mplement logic of checking permissions

* Fix small dagger issue to inject location manager properly

* Request permission for nearby places if fragment is loaded and tab is selected

* Initialize map operations if map ready and tab is selected

* Markers loads at correct time

* Style the map according to new version of mapbox map

* Add some map elements like FABs and give their actions

* Implement map marker click actions

* Implement nearby Fabs logic with a small issue

* fix FABs are not closing problem

* Unkown problem occurs at map load when I try to use MainActivity again.

* Revert "Unkown problem occurs at map load when I try to use MainActivity again."

This reverts commit 3dc0844.

* Search this area buttons are added but button function does not work and button visibility is problematic

* Fix issue with MainActivity with the help of Ashish

* Fix search this area button visibility issue

* Fix the issues with updating search nearby markers and camera position together

* Fix progress bar visibility issue

* Prevent loding map each time tab selected

* Take toolbar back

* Implement back button with presenter

* Add click actoion to bottom sheet details

* Add nearby list into bottom sheeet

* Make reuse existing fragments if there is any

* Code cleanup

* Cleanup

* Code cleanup

* Add lifecyle codes to prevent leaks

* Cleanup

* Code cleanup

* cleanup

* Make list item clicked and map focus to same place

* Add bookmark from list fragment

* Make nearby card click action work

* Revert "Fix conflicts"

This reverts commit f345174, reversing
changes made to c5d4d55.

* Code cleanup

* Cleanup

* Make recenter button work when list sheet is expanded

* Cleanup

* Code cleanups

* NPE issue is not detected for now, can be solved on seperate PR

* Update map after Wikidata edit

* Cherry picked previously reverted merge, hoping this will fix enourmus amounts of diff files

* Previous merge bringed an file which should be deleted. Delete it.

* Revert irrelevant changes on build.gradle

* Revert irrelevant changes

* Jetbrains annotation is not included to build gradle, this issue caused build issues on my branch so I removed it to be able to build

* Rename ListView

* Use a singleton to access the presenter, instead of passing it to a variable inside fragment

* Fix code style issues

* Move hardcoded colors to colors.xml file

* Make larger methods smaller

* Make current location marker follow

* Do not track users position if user is searching around

* Revert irrelevant shanges at build gradle

* Remove unneeded variable

* Remove mvp directory, add sub directories directly under nearby directory instead

* Remove unneeded public definiton

* Remove unneeded namespace

* Add public defiiton, it is needed to reach the constructor.

* On Logout, fetch the CSRF token and then make the post logout call (#3182)

* Api call for logout

* call clear cached onCompleteSessionLogout

* Correction is passed file name to checkPageExistsUsingTitle, function expects file name prefixed with File: (#3194)

* Merge master (#3196)

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Localisation updates from https://translatewiki.net.

* Mapped values-en-gb to values-en-rGB (#3161)

Fixes "Error: Invalid resource directory name" bug.

* Localisation updates from https://translatewiki.net.

* Removes the "Other" deletion option mentioned in #3174 (#3183)

* Localisation updates from https://translatewiki.net.

* Renamed resource file to prevent build from failing (#3189)

* Localisation updates from https://translatewiki.net.

* Removed some jargon/slang from strings.xml (#3162)

* Localisation updates from https://translatewiki.net.

* solve issue Avoid 'form movements' in the login screen #1107 (#2936)

* Disabled review buttons while an image is being loaded (#3185)

* Disabled review buttons while an image is being loaded

* Added javadocs for the new methods

* Fix build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment