I developed a website that uses react.js and django, and my question is if it is possible to upload it to a vps server.
I am doing a delete of a user and it works by placing his id in req.params.id. However, when doing the delete again to the same id it sends a null, I want to know if it is possible to handle errors that return a user that does not exist and not just null When doing get of the deleted user it also indicates null and I want to send a user not found error how can I do to return an error and not just null.
Here is the example I have:
// eliminar Usuario
router.delete("/usuario/:id", async (req, res) => {
const { id } = req.params;
UsuarioSchema
.findByIdAndRemove({ _id: id })
.then((data) => await = res.status(200).send("usuario eliminado con exito" + data))
.catch((error) => res.status(404).send("usuario no encontrado" + error));
});
This code works for me, it deletes a user from my database, but when I run it again it doesn't give me an error, it sends me a status 200 but with a null user. That's why I want to add an error handling that if the user is null it also tells me that it doesn't exist.
I have created the following formula to determine my time shift:
=SI(O(MES(HOY()) = 7; MES(HOY()) = 8); "7:00"; SI(DIASEM(HOY(); 2) = 5; "6:00"; "8:45"))
I want to establish a comparison with another cell that returns the hours worked for any given day, so that if the minimum established by the formula is not reached, the cell is colored red.
The cell in question, D12
, adds the time spent on the different tasks, =SUMA(D2:D11)
:
All cells that do not include text have the following format:
The "Start" and "End" columns represent the start and end time of each task, and "Duration" the duration in hours of the task, such that =B2-A2
, and so on for the rest of the tasks.
The problem, I think, is that Excel doesn't recognize the format of the value of F12
and the one returned by the conditional formula as equivalent, so the color, applied using the "Conditional Formatting" option, doesn't work correctly.
How could I fix it?
This script behaves as expected.
<script>
let cadena = "soy una cadena";
let cadenaI = cadena.split("").join("/");
console.log("soy cadenaI: "+cadenaI);
</script>
This second script does not run as expected, being apparently the same:
<script>
let cadena2 = "soy una cadena";
let cadena2I = cadena.split("");
cadena2I.join("/");
console.log("soy cadena2I: "+cadena2I);
</script>
I have this statement:
Which brand or brands offer two different types of fuel?
I have managed to display the following list:
make fuel-type size
0 alfa-romero gas 3
1 audi gas 7
2 bmw gas 8
3 chevrolet gas 3
4 dodge gas 9
5 honda gas 13
6 isuzu gas 4
7 jaguar gas 3
8 mazda diesel 2
9 mazda gas 15
In principle, it shows me the results well: mazda has two types of fuels and the others do not. But how can I obtain only the Mazda brand, which is the one that fulfills the statement?
I show the table with this code;
data.groupby(['make','fuel-type'], as_index=False).size()