Commit f2c6ddf1 authored by Floréal Cabanettes's avatar Floréal Cabanettes

Fix coup de coeur support for pywebcooking

parent f48b514f
......@@ -820,8 +820,24 @@ bool Functions::saveRecipeFromPwcJson(QVariantMap recipe, int config, QFile *tmp
categories[ii] = categories[ii].replace("&", "&&");
}
QString coup_de_coeur = "";
if (recipe.contains("coup_de_coeur")) {
int coup_de_coeur_read = recipe["coup_de_coeur"].toInt();
switch (coup_de_coeur_read) {
case 1:
coup_de_coeur = "coup_de_coeur_1";
break;
case 2:
coup_de_coeur = "coup_de_coeur_2";
break;
case 3:
coup_de_coeur = "coup_de_coeur_3";
break;
}
}
return saveRecipeToFile(recipe["title"].toString(), categories, tpsPrep, tpsCuis, tpsRep, recipe["nb_people"].toString(),
recipe["precision"].toString(), description, ingredients, equipment, instructions, proposals, picture_url, liens, tmpFile, "", recipe["id"].toInt());
recipe["precision"].toString(), description, ingredients, equipment, instructions, proposals, picture_url, liens, tmpFile, coup_de_coeur, recipe["id"].toInt());
}
/**
......
......@@ -315,7 +315,12 @@ void SendPyWebCooking::sendRecipe() {
input.add_var("precision", precision);
input.add_var("description", description);
if (serverConfs[config]["recCoupDeCoeur"] == "1") {
input.add_var("coup_de_coeur", coupDeCoeur);
QHash<QString,QString> coup_de_coeur_conv;
coup_de_coeur_conv["no_coup_de_coeur"] = "0";
coup_de_coeur_conv["coup_de_coeur_1"] = "1";
coup_de_coeur_conv["coup_de_coeur_2"] = "2";
coup_de_coeur_conv["coup_de_coeur_3"] = "3";
input.add_var("coup_de_coeur", coup_de_coeur_conv[coupDeCoeur]);
}
input.add_var("nb_people", QString::number(nbPeople));
input.add_var("nb_people_max", QString::number(nbPeopleMax));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment