- changed title to Update anime/manga (status) not working in some cases.
- marked as critical
Update anime/manga (status) not working in some cases.
I was testing the app yesterday and I found an issue If you update your status with the status types I used below it wont update on MAL.
in progress, on-hold and plan to watch.
I suspect that anime model contains the issue.
public static function getWatchedStatus($status) {
switch($status) {
case 'watching':
return '1';
break;
case 'completed':
return '2';
break;
case 'onhold':
return '3';
break;
case 'dropped':
return '4';
break;
case 'plantowatch':
return '6';
break;
default:
return '1';
break;
}
}
plantowatch and onhold must be changed into plan to watch and on-hold. This is what I think,
I am currently busy with moving the stings of the app.
Comments (6)
-
reporter -
Neither Anime->getWatchedStatus() nor Manga->getReadStatus() are used anywhere in the code. They aren't the problem and should be removed as dead code.
The problem appears to be a mismatch in the string values the Ruby API uses and in what the MAL XML values are.
As an example, the status values for anime as accepted by the Ruby API are listed here and are:
1/"watching", 2/"completed", 3/"on-hold"/"onhold", 4/"dropped", 6/"plan to watch"/"plantowatch"
While the values accepted by MAL are listed here and are:
1/watching, 2/completed, 3/onhold, 4/dropped, 6/plantowatch
Both will accept integer values, but also strings for the specific state. As you can see, the Ruby API is looser in what it allows, including hyphens and spaces in the strings. We should probably parse to a standard format when creating our Anime object out of the update request, and then always convert to an int when making our MAL XML.
I don't think I hit this issue because I was testing status changes between the ones that are always single words. Go figure...
I'm half-tempted to convert the properties of the models to private and require use of setters and getters just to force normalized data, but the issue isn't big enough to call for that amount of work at this point.
-
reporter So if I am right atarashii is using on-hold and plan to watch but MAL doesn't allow that. We could just add str_replace and replace the space and the '-'.
That is the easiest way.
ps. We should remove the old codes. I am currently moving the hardcodedstrings to strings.xml.
-
Bare str_replace seems like it's asking for a problem. I might create a setter specifically for this property just to make sure the internal data is standard and then we can manipulate it in the XML creation to what the XML format requires. Since the contents should be standard, it'll make for a cleaner consumption of the data.
P.S. Keep the discussion on this project specifically about this project, it makes it easier if needed to look back for future reference. If you want to discuss Atarashii, start an issue on that project.
-
reporter -
assigned issue to
I will leave this issue to you. You know probably the best solution ;)
-
assigned issue to
-
- changed status to resolved
Add some Get and Set Methods for Complex Types
For both Anime and Manga, we have to take different inputs and normalize them. Standardize on using set and get methods instead of “parse” methods to store data as it’s the general standard for projects.
This fixes
#20This also is related to#21→ <<cset f828953f91f5>>
- Log in to comment
This bug is also inside the manga model.