maproulette / maproulette/maproulette-backend

Challenge creation/update - default difficulty level not set for invalid values

Open
#106 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BACKLOG
Dominant language
Scala
Stars
53
Forks
39
Avg merge
1d 17h
Merged PRs (30d)
12

Description

If the user supplies an invalid integer value for the difficulty level at challenge creation or update the default value is not set for this field.
Request JSON:

{
  "name": "Misnamed Double Digitized Ways",
  "parent": 2,
  "identifier": "misnameddoubledigitizedways",
  "difficulty": 5,
  "description": "",
  "blurb": "Double digitized ways with inconsistent naming",
  "instruction": "Fix the inconsistent naming of what seems to be a single double-digitized road.",
  "help": ""
}

Response JSON:

{"id":31,"name":"Misnamed Double Digitized Ways","description":"","parent":2,"instruction":"Fix the inconsistent naming of what seems to be a single double-digitized road.","difficulty":5,"blurb":"Double digitized ways with inconsistent naming","enabled":true,"challengeType":1,"featured":false}

If the user supplies a non-numeric invalid value for the difficulty level at challenge creation or update the operation fails. In this case the default value should be set.

Request JSON:

{
  "name": "Misnamed Double Digitized Ways",
  "parent": 2,
  "identifier": "misnameddoubledigitizedways",
  "difficulty": "blabla",
  "description": "",
  "blurb": "Double digitized ways with inconsistent naming",
  "instruction": "Fix the inconsistent naming of what seems to be a single double-digitized road.",
  "help": ""
}

Response JSON:

{"status":"KO","message":{"obj.difficulty":[{"msg":["error.expected.jsnumber"],"args":[],responseCode:400}],responseCode:400},responseCode:400}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the challenge creation and update handlers and tracing how the difficulty field is validated and defaulted. Compare the numeric and non-numeric request examples, then add or run coverage showing that both invalid forms use the existing default rather than failing.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.