Fixed issue #3195 ordering contribution list (#3589)

* issue-#3195: order contribution list refactored

* issue-#3195: ordered contribution list
This commit is contained in:
Prince Amankwah 2020-04-06 13:54:51 +02:00 committed by Josephine Lim
parent b6df5f2a66
commit bc8ce94d76
2 changed files with 12 additions and 2 deletions

View file

@ -286,7 +286,7 @@ public class UploadService extends HandlerService<Contribution> {
contribution.setFilename(canonicalFilename);
contribution.setImageUrl(uploadResult.getImageinfo().getOriginalUrl());
contribution.setState(Contribution.STATE_COMPLETED);
contribution.setDateUploaded(CommonsDateUtil.getIso8601DateFormatShort()
contribution.setDateUploaded(CommonsDateUtil.getIso8601DateFormatTimestamp()
.parse(uploadResult.getImageinfo().getTimestamp()));
compositeDisposable.add(contributionDao
.save(contribution)

View file

@ -13,11 +13,21 @@ public class CommonsDateUtil {
/**
* Gets SimpleDateFormat for short date pattern
* @return
* @return simpledateformat
*/
public static SimpleDateFormat getIso8601DateFormatShort() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat;
}
/**
* Gets the timestamp pattern for a date
* @return timestamp
*/
public static SimpleDateFormat getIso8601DateFormatTimestamp() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat;
}
}