From 216c4edf174b56c875b95362332c790efdba7795 Mon Sep 17 00:00:00 2001 From: gsovereignty Date: Wed, 14 Aug 2024 14:13:12 +0800 Subject: [PATCH] problem: we are publishing vote note even if vote failed --- src/components/MeritSummaryCard.svelte | 178 +++++++++++------------ src/components/VoteOnMeritRequest.svelte | 24 +-- 2 files changed, 101 insertions(+), 101 deletions(-) diff --git a/src/components/MeritSummaryCard.svelte b/src/components/MeritSummaryCard.svelte index 5a2a507..4a3b393 100644 --- a/src/components/MeritSummaryCard.svelte +++ b/src/components/MeritSummaryCard.svelte @@ -131,93 +131,96 @@ /> - -
-
Merit Request Details
-
    -
  • - Number of Merits being requested - {merit.Merits.toLocaleString()} -
  • -
  • - - Value in Sats at the time the request was made - - {merit.Sats.toLocaleString()} -
  • -
  • - - Approximate value of {merit.Sats.toLocaleString()} sats in CuckLoserBucks - - ${cuckPrice ? ((merit.Sats / 100000000) * cuckPrice).toFixed(2) : 'Loading'} -
  • -
- -
-
-
Analysis
- -

- To make it easier to compare the value of each contribution we normalize the hourly - rate to $50 CuckLoserBucks an hour. -

-

- At this rate, the contributor is claiming to have worked for {referenceTime} solving - this problem. -

-
-
-
-
Reference Time
-
{referenceTime}
-
-
- -
Votes
- {#if $votes.size == 0}Waiting for existing {parsedRocket.Name()} Merit holders - to vote - {/if} - - - {#each $votes as [id, vote], _ (id)} - { - console.log(vote.Event.rawEvent()); - }} - class="cursor-pointer {vote.VoteDirection == 'ratify' - ? 'bg-lime-600' - : 'bg-red-700'} {vote.VoteDirection == 'ratify' - ? 'hover:bg-lime-700' - : 'hover:bg-red-800'}" - > - -
- - -
-
- - {unixToRelativeTime(vote.TimeStamp * 1000)} -
- {/each} -
-
-
+ +
+
Merit Request Details
+
    +
  • + Number of Merits being requested + {merit.Merits.toLocaleString()} +
  • +
  • + + Value in Sats at the time the request was made + + {merit.Sats.toLocaleString()} +
  • +
  • + + Approximate value of {merit.Sats.toLocaleString()} sats in CuckLoserBucks + + ${cuckPrice ? ((merit.Sats / 100000000) * cuckPrice).toFixed(2) : 'Loading'} +
  • +
+ +
+
+
Analysis
+ +

+ To make it easier to compare the value of each contribution we normalize the hourly + rate to $50 CuckLoserBucks an hour. +

+

+ At this rate, the contributor is claiming to have worked for {referenceTime} solving this + problem. +

+
+
+
+
Reference Time
+
{referenceTime}
+
+
+ +
Votes
+ {#if $votes.size == 0}Waiting for existing {parsedRocket.Name()} Merit holders + to vote + {/if} + + + {#each $votes as [id, vote], _ (id)} + { + console.log(vote.Event.rawEvent()); + }} + class="cursor-pointer {vote.VoteDirection == 'ratify' + ? 'bg-lime-600' + : 'bg-red-700'} {vote.VoteDirection == 'ratify' + ? 'hover:bg-lime-700' + : 'hover:bg-red-800'}" + > + +
+ + +
+
+ + {unixToRelativeTime(vote.TimeStamp * 1000)} +
+ {/each} +
+
+
+ console.log(merit.Event.rawEvent())} + >print to console
+ {#if merit.IncludedInRocketState(parsedRocket)} APPROVED @@ -227,9 +230,6 @@ {:else if !result} {/if} - console.log(merit.Event.rawEvent())} - >print to console diff --git a/src/components/VoteOnMeritRequest.svelte b/src/components/VoteOnMeritRequest.svelte index cd913a1..260292f 100644 --- a/src/components/VoteOnMeritRequest.svelte +++ b/src/components/VoteOnMeritRequest.svelte @@ -32,19 +32,19 @@ .publish() .then((x) => { console.log(x); + if (direction === 'ratify') { + let content = `I've voted to ratify your merit request! ${merit.Problem()} \n\n ${merit.Solution() ? merit.Solution() : ''}`; + prepareMeritNoteEvent({ + ndk, + merit, + content + }) + .publish() + .then((x) => { + console.log(x); + }); + } }); - if (direction === 'ratify') { - let content = `I've voted to ratify your merit request! ${merit.Problem()} \n\n ${merit.Solution() ? merit.Solution() : ''}`; - prepareMeritNoteEvent({ - ndk, - merit, - content - }) - .publish() - .then((x) => { - console.log(x); - }); - } } $: currentUserHasVotepower = false;