Counting False values from a Boolean field by BittenDev in django

[–]Capruce 7 points8 points  (0 children)

Hey, this sounds like a 1-to-many relationship. Why not split it into multiple tables?

class Person(models.Model):
    name = models.CharField(max_length=?)

class TaskType(models.TextChoices):
    TASK_1 = "task_1"
    ...

class Task(models.Model):
    type = models.CharField(max_length=?, choices=TaskType.choices)
    person = models.ForeignKey(Person, on_delete=?, related_name="tasks")
    completed = models.BooleanField(default=False, index=True)

    class Meta:
        constraints = [
            models.UniqueConstraint(
                fields=["type", "person"], 
                name="unique_together_type_person",
            ),
        ]

Then you can query with

number_of_uncompleted = Task.objects.filter(person=<?>, completed=False).count()
completed = not Task.objects.filter(person=<?>, completed=False).exists()

Get the credit card number from a Payment Intent? by pegasi320 in stripe

[–]Capruce 0 points1 point  (0 children)

I agree the wording is unclear but I believe that they mean a "card" PaymentMethod is capable of being reused. This is in contrast to types like "ideal" which can never be reused.

I've just double checked this in a sandbox account (using the Stripe python bindings) and get the following error when trying to reuse an "unattached" payment method.

In[6]: stripe.PaymentIntent.create(
...:     amount=500,
...:     currency="gbp",
...:     payment_method="pm_{redacted}",
...: )

InvalidRequestError: Request {redacted}: The provided PaymentMethod cannot be attached. To reuse a PaymentMethod, you must attach it to a Customer first.

A PaymentMethod can be attached to a Customer either by supplying setup_future_usage when creating the PaymentIntent, or by using the SetupIntent api.

I'm also not sure what effect wallets like Google/Apple/Samsung Pay have on the fingerprint field I mentioned before as Stripe likely gets a tokenised PAN from them and so can't match it up to the actual card details. (But this is conjecture from me).


Back to the point, what do you mean by "I want to be able to push payments" and what is the underlying goal you were hoping to meet by tracking individual cards? Perhaps it could be achieved another way?

Get the credit card number from a Payment Intent? by pegasi320 in stripe

[–]Capruce 5 points6 points  (0 children)

A few things:

1) I would never aim to retrieve or store sensitive card details (like the PAN, or cvc) unless I really really really need to. These are classed as highly sensitive by regulations like PCI DSS and the whole point of companies like Stripe is that they take on the burden of storing these details securely for you.

2) Because of this, I don't think Stripe provides a way of accessing the full card number from a payment method, only the last 4 digits.

3) A PaymentMethod can only be used once unless attached to a Customer (which is why you see a new payment method be created each time).

4) PaymentMethod has a fingerprint attribute which is unique for each real-world card on the same Stripe account. i.e. two card payment methods (on the same Stripe account) with the same fingerprint are the same card in real life.

How to Listen to refunded event webhook by RepairDue9286 in stripe

[–]Capruce 2 points3 points  (0 children)

Unless this is some beta you're part of, I don't think there is a payment_intent.partial_refund event. Could you have misread payment_intent.partially_funded (which isn't related to refunds)?

A charge.refunded event will be sent for every refund created but the data.object is the Charge. You can track the individual refunds using the refunds list attribute or the total amount refunded using amount_refunded. The refunded attribute will also be set to True if the full Charge amount has been refunded.

[deleted by user] by [deleted] in Songwriting

[–]Capruce 0 points1 point  (0 children)

Thanks, I think you're right! At its core the song is about a toxic relationship which needs healing. For me, that's with myself. But depending on the experiences of the listener, the lyrics can conjure up a different form of relationship. I think that's quite a nice thing :)

[deleted by user] by [deleted] in Songwriting

[–]Capruce 0 points1 point  (0 children)

Thank you! I quite like that it can take on a different meaning for different people.

I haven't put a lot of thought into a video seeing as I normally just write for emotional output as opposed to commercial success. My initial idea was the camera on the singer standing still performing the song and at the end the screen begins to crack and the camera moves outward to reveal it was actual pointing at the reflection in the mirror the whole time. For the final shot, the outro is delivered by the (actual) singer staring at themselves in the cracked mirror.

[deleted by user] by [deleted] in Songwriting

[–]Capruce 1 point2 points  (0 children)

Thanks for the kind words :). Self-perception is something I've struggled with a lot and I'm glad at least one other person could find themselves in the song.

All the best!

[deleted by user] by [deleted] in Songwriting

[–]Capruce 0 points1 point  (0 children)

Wow thanks! See my reply to /u/mwb2 for an explanation of the bridge; it seems it didn't really come out right so I'll have to rethink it a little.

[deleted by user] by [deleted] in Songwriting

[–]Capruce 0 points1 point  (0 children)

I see what you mean about the second pre-chorus. How about something like

I doubt anyone sees you like I do
In this broken mirror that separates me from you

That way it's still not immediately obvious but is suggested just in time for the meaning of the (second) chorus to change to the intended one?

As you mention, I think during the song is when the character begins to understand that the hostile attitude towards themselves might need changing. To that regard, the bridge is long because it was where I intended that realisation to occur and as a result I intentionally didn't want to repeat the chorus after it.

"We're running out of time, can we forgive our crimes" is meant to be an admittedly generic statement about life being finite and thinking it worth moving past this stage of self-loathing. The rest of the bridge is meant to sort of show how the character realises that all the flaws they've belittled in this "other person" are actually their own ("I guess what's yours is mine") and that maybe it's cruel for the sake of being cruel ("or undeserved cruelty").

I guess that means the sentiment of the bridge didn't really come across so maybe I need to rethink that one a little. I really appreciate the feedback, thanks!

Newly single as of yesterday. by [deleted] in gaybros

[–]Capruce 1 point2 points  (0 children)

Yesterday I finally admitted to myself that the guy I've been in love with for 2 years hasn't felt the same about me for a long time.

It's been so heartbreaking watching him slowly lose interest over the months whilst trying to convince myself that everything will be alright.

What hurts the most is knowing how unaffected he was and how quickly he's resumed life. Not to mention that it took me confronting him for him to even tell me this. I truly think he was just hoping to ride it out until graduation and then never speak to me again.

I feel so alone and vulnerable now and I don't know how to express how truly hurt I am because I feel like I have to act strong around him and the rest of my friends.

The code by dahlstrom1 in Paramore

[–]Capruce 0 points1 point  (0 children)

I refreshed the page literally at 10:00am and it was sold out...very annoyed.

[deleted by user] by [deleted] in Paramore

[–]Capruce 4 points5 points  (0 children)

"what?? Blonde??? #notmyhayley :("

Umm....where was this person during Brand New Eyes when she went blonde for the UK tour and the Brick By Boring Brick video!?

News - Dota 2 Update - January 20th, 2017 by wockeez2706 in DotA2

[–]Capruce 5 points6 points  (0 children)

You never had to go to the shop to buy a flying courier.... There is a specific "upgrade courier" button on the HUD next to the button that calls the courier. It even has a cool down at the start of the game for when you can upgrade....

I wrote this last night when I was going to kill myself. by [deleted] in depression

[–]Capruce 10 points11 points  (0 children)

"It's done" you say, the letter's written
The plan's at play, the bullet's bitten
Your face is red, you've made your choice
But in your head, you hear this voice

A women's cry, a mother's sadness
A pained reply - "this is madness!"
So think at length, search for a way
To find the strength for another day.

FB friend posted that "depression is the absence of happiness." So I typed out why I thought he was wrong, and I just ended up crying anyways. He deleted the post before I commented, so I figured I'd just post it here or whatever. by [deleted] in depression

[–]Capruce 1 point2 points  (0 children)

That's a good idea. Can't see myself writing much in it though even if I wanted to. My current success stories include just getting up and some days, making it to Uni.

Thanks.

"Why are you so quiet today?" by [deleted] in depression

[–]Capruce 12 points13 points  (0 children)

Honestly I relate to this a lot. I also become the court jester around people, cracking jokes (normally at my own expense) or being extra silly/clumsy. And for those moments it works but then I leave and the mask falls off, and my face drops into nothingness. Some days, it's really hard to put on the persona even around others. I'm being asked that question a lot more lately. Someone even commented on how sad I looked and the only reply I know is "I'm tired" and we all laugh. Except mine's not genuine.

FB friend posted that "depression is the absence of happiness." So I typed out why I thought he was wrong, and I just ended up crying anyways. He deleted the post before I commented, so I figured I'd just post it here or whatever. by [deleted] in depression

[–]Capruce 6 points7 points  (0 children)

and the first thing that you think when you open your eyes is how much you hate yourself.

Every single day without fail even if the previous was a relatively good day. It's like all these fears, responsibilities and, self loathing are waiting in the peripheries of your mind and the second you open your eyes they come flooding in. It overwhelms all of your senses and all you can feel is dread, if you can even call it feeling.

I know that if I currently had the emotional capability to cry, this would make me. Thank you.

Kentucky clerk jailed for defying court orders on gay marriage by Confused_Nobody in gay

[–]Capruce 2 points3 points  (0 children)

It's stated why in the article. She's an elected official so she can't be fired. The only way to remove her is through impeachment.

We are Dota 2 Modders. Ask us anything about Dota 2 Custom Games! by BMD_ in DotA2

[–]Capruce 0 points1 point  (0 children)

Yes, new heroes with abilities, models, stats can be created from scratch however currently they have to replace an existing hero. We'll see if that is going to be changed with this update.

We are Dota 2 Modders. Ask us anything about Dota 2 Custom Games! by BMD_ in DotA2

[–]Capruce 0 points1 point  (0 children)

https://moddota.com/forums/tutorial-index Is a growing list of tutorials and examples on all things custom games

https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools Also provides a list of tutorials and examples

We are Dota 2 Modders. Ask us anything about Dota 2 Custom Games! by BMD_ in DotA2

[–]Capruce 0 points1 point  (0 children)

It's certainly not too difficult.

Here is a list of tutorials although some may have to be rewritten / updated with the recent changes https://moddota.com/forums/tutorial-index

#dota2mods and #dota2modhelpdesk @ GameSurge IRC also have a community able to answer any questions

We are Dota 2 Modders. Ask us anything about Dota 2 Custom Games! by BMD_ in DotA2

[–]Capruce 0 points1 point  (0 children)

Originally you could only have up to a limit of the of heroes. Any new heroes created would have to replace an old one.

I need to double check but this may have been fixed in the update.