Skip to content

add latest berries and alter schema to allow empty properties from th…#1572

Open
programgames wants to merge 3 commits into
PokeAPI:masterfrom
programgames:add-latest-berries
Open

add latest berries and alter schema to allow empty properties from th…#1572
programgames wants to merge 3 commits into
PokeAPI:masterfrom
programgames:add-latest-berries

Conversation

@programgames

@programgames programgames commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

#1126
I added both hopo berry and roseli item.

Also Kee,Marangua,Hopo and Roseli berries in the berry table.
As you said in the issue, new berries don't have much properties as old ones do I had to change the schema to allow empty values.

Datas came from Serebii and bulbapedia :

and then :

I would like to know if it a good practice to add new data add the end of the file like I did.

Thank you

@Naramsim Naramsim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's ok to put everything at the end of the file

Comment thread data/v2/build.py Outdated
Comment thread data/v2/build.py Outdated
]

operations = [
migrations.AlterField(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we really need these? Can they not just be values like 0? (Note: berries are a weak domain of my pokemon knowledge)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since Sword and Shield, the concept of crop cultivation has been removed, null values from my point of view seems more appropriate because if we use 0 it would say 'this berry has a natural gift of 0' for example. But this concept doesn't exist in SW, SV and after.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, better to allow null fileds in this case.

Comment thread data/v2/build.py Outdated
Comment thread data/v2/build.py Outdated
@programgames

Copy link
Copy Markdown
Contributor Author

Corrections done

@jemarq04 jemarq04 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just a couple comments. Also, could you run make format to fix the python script formatting you're adding?

Comment thread data/v2/build.py
Comment on lines -1007 to +1014
berry_firmness_id=int(info[2]),
natural_gift_power=int(info[3]),
natural_gift_type_id=int(info[4]),
size=int(info[5]),
max_harvest=int(info[6]),
growth_time=int(info[7]),
soil_dryness=int(info[8]),
smoothness=int(info[9]),
name=item.name[: -len("-berry")] if item.name.endswith("-berry") else item.name,
berry_firmness_id=int(info[2]) if info[2] and info[2].strip() else None,
natural_gift_power=int(info[3]) if info[3] and info[3].strip() else None,
natural_gift_type_id=int(info[4]) if info[4] and info[4].strip() else None,
size=int(info[5]) if info[5] and info[5].strip() else None,
max_harvest=int(info[6]) if info[6] and info[6].strip() else None,
growth_time=int(info[7]) if info[7] and info[7].strip() else None,
soil_dryness=int(info[8]) if info[8] and info[8].strip() else None,
smoothness=int(info[9]) if info[9] and info[9].strip() else None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we need to check the stripped value. We don't really make that check anywhere else, and I don't believe we've had any issues of unexpected whitespace.

Comment thread data/v2/build.py
growth_time=int(info[7]),
soil_dryness=int(info[8]),
smoothness=int(info[9]),
name=item.name[: -len("-berry")] if item.name.endswith("-berry") else item.name,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
name=item.name[: -len("-berry")] if item.name.endswith("-berry") else item.name,
name=item.name[:-6] if item.name.endswith("-berry") else item.name,

No need to determine the length of a constant string, we can write that in. I'm also thinking using

name=item.name.split("-berry")[0]

would do the same thing and make it clear that you're trying to remove that suffix if it exists, though both could work.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants