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

Maditory feature id requirement #1146

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions app/org/maproulette/provider/ChallengeProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,13 @@ class ChallengeProvider @Inject() (
if (!challenge.extra.osmIdProperty.getOrElse("").isEmpty) {
return featureOSMId(value, challenge) match {
case Some(osmId) => osmId
case None => UUID.randomUUID().toString // task does not contain id property
case None =>
throw new InvalidException(
s"External ID property '${challenge.extra.osmIdProperty}' not found. To resolve this issue, you have two options: " +
"1. Remove the external ID, and Maproulette will attempt to use one of the default IDs: 'id', '@id', 'osmid', 'osm_id', or 'name'. " +
"2. Provide a valid external ID that matches your data. " +
"Rebuild the challenge after these changes are made."
)
}
}

Expand All @@ -353,11 +359,10 @@ class ChallengeProvider @Inject() (
(value \ "properties").asOpt[JsObject] match {
// See if we can find an id field on the feature properties
case Some(properties) => taskNameFromJsValue(properties, challenge)
case None =>
// if we still don't find anything, create a UUID for it. The
// caveat to this is that if you upload the same file again, it
// will create duplicate tasks
UUID.randomUUID().toString
case None =>
throw new InvalidException(
s"One or more tasks in your GeoJSON file are missing one or more of the required feature IDs: 'id', '@id', 'osmid', 'osm_id', or 'name'. These IDs are necessary for each task to build a challenge correctly. Please upload a valid GeoJSON file, and rebuild the tasks."
)
}
}
}
Expand Down
Loading