09/17 - Mantequilla Monday!

Status
Not open for further replies.

charlie

Well-Known Member
Joined
Nov 3, 2016
Messages
6,676
Reaction score
10,742
Points
938
Age
49
Gender
Male
butter eh? we shall see. haha. i'm already behind the 8 ball. getting brakes dealt with this morning. i won't make $500 by the end of the week but i'll put some sort of dent in the whole thing.
 

SarahAshlee90

Well-Known Member
Crowd Pleaser
Joined
Mar 4, 2016
Messages
2,781
Reaction score
5,294
Points
963
Age
33
Gender
Female
Oh holy shit that's kinda cool.
2 bucks behind you.
I posted the github link for the script, its also on reddit if you want to try. I was mainly posting it to try and figure out who is in front of me.
 
  • Like
Reactions: C to the J

Metallica

Never free, never me
Contributor
Joined
Jan 17, 2016
Messages
5,319
Reaction score
14,228
Points
1,113
Age
33
Gender
Male
:wackodance That's the best emoji thing to describe today.
 
  • Like
Reactions: Rogue and Ready

SarahAshlee90

Well-Known Member
Crowd Pleaser
Joined
Mar 4, 2016
Messages
2,781
Reaction score
5,294
Points
963
Age
33
Gender
Female
Code:
// ==UserScript==
// @name         mTurk Slow or Just Me?
// @namespace    salembeats
// @version      1.55
// @description  UPDATE: More timezone-fixing stuff. NOTE: Requires Kadauchi's "MTurk Dashboard Enhancer" script to function properly.
// @author       Cuyler Stuwe (salembeats)
// @include      https://worker.mturk.com/dashboard*
// ==/UserScript==

const globals = {
    CLIENT_VERSION: "synchronicity",
    API_BASE: "https://ne26dv9hq6.execute-api.us-west-2.amazonaws.com/dev"
};

// Minified, synchronous SHA-256 transform function copied from: http://geraintluff.github.io/sha256/
var sha256=function a(b){function c(a,b){return a>>>b|a<<32-b}for(var d,e,f=Math.pow,g=f(2,32),h="length",i="",j=[],k=8*b[h],l=a.h=a.h||[],m=a.k=a.k||[],n=m[h],o={},p=2;64>n;p++)if(!o[p]){for(d=0;313>d;d+=p)o[d]=p;l[n]=f(p,.5)*g|0,m[n++]=f(p,1/3)*g|0}for(b+="\x80";b[h]%64-56;)b+="\x00";for(d=0;d<b[h];d++){if(e=b.charCodeAt(d),e>>8)return;j[d>>2]|=e<<(3-d)%4*8}for(j[j[h]]=k/g|0,j[j[h]]=k,e=0;e<j[h];){var q=j.slice(e,e+=16),r=l;for(l=l.slice(0,8),d=0;64>d;d++){var s=q[d-15],t=q[d-2],u=l[0],v=l[4],w=l[7]+(c(v,6)^c(v,11)^c(v,25))+(v&l[5]^~v&l[6])+m[d]+(q[d]=16>d?q[d]:q[d-16]+(c(s,7)^c(s,18)^s>>>3)+q[d-7]+(c(t,17)^c(t,19)^t>>>10)|0),x=(c(u,2)^c(u,13)^c(u,22))+(u&l[1]^u&l[2]^l[1]&l[2]);l=[w+x|0].concat(l),l[4]=l[4]+w|0}for(d=0;8>d;d++)l[d]=l[d]+r[d]|0}for(d=0;8>d;d++)for(e=3;e+1;e--){var y=l[d]>>8*e&255;i+=(16>y?0:"")+y.toString(16)}return i};

function exists(thing) {
    return thing !== undefined && thing !== null;
}

function amazonDate() {
    return new Date(Date.now() + (new Date().getTimezoneOffset()*60*1000) - (420*60*1000));
}

function medianOfSortedValues(sortedValuesArray) {

    const middlePosition = Math.floor(sortedValuesArray.length/2);

    if(sortedValuesArray.length % 2) {
        return sortedValuesArray[middlePosition];
    }
    else {
        return (sortedValuesArray[middlePosition-1] + sortedValuesArray[middlePosition]) / 2.0;
    }

}

function sidesOfMedian(sortedValuesArray) {

    const hasEvenNumberOfItems = ( sortedValuesArray.length % 2 === 0 );

    if(hasEvenNumberOfItems) {
        return [
            sortedValuesArray.slice(0, (sortedValuesArray.length / 2)),
            sortedValuesArray.slice((sortedValuesArray.length / 2), sortedValuesArray.length)
        ];
    }
    else {
        const indexToSplitOn = ((sortedValuesArray.length + 1) / 2) - 1;

        return [
            sortedValuesArray.slice(0, indexToSplitOn),
            sortedValuesArray.slice(indexToSplitOn + 1, sortedValuesArray.length)
        ];
    }
}


function hitLogTotalUsd() {

    const hitLog = JSON.parse(localStorage.getItem("WMTD_hitLog"));

    return Object.keys(hitLog).reduce((acc, currentHitLogKey) => {

        return (acc + hitLog[currentHitLogKey].reward.amount_in_dollars);

    }, 0);

}

function dateYYYYMMDD(date) {

    const now = date;
    const [year, month, day] = [now.getFullYear(), now.getMonth() + 1, now.getDate()].map(num => num.toLocaleString("en-US", {minimumIntegerDigits: 2, useGrouping: false}));
    const todaysDateStr = `${year}-${month}-${day}`;
    return todaysDateStr;

}

function todaysDateYYYYMMDD() {
    return dateYYYYMMDD(new Date());
}

function amazonDateYYYYMMDD() {
    return dateYYYYMMDD(amazonDate());
}

function lastWorkLoggedDateYYYYMMDD() {
    return localStorage.getItem("WMTD_date");
}

function todaysTotal() {

    const lastRecordedDate = lastWorkLoggedDateYYYYMMDD();

    if(lastRecordedDate === amazonDateYYYYMMDD()) {

        return hitLogTotalUsd();

    }
    else {

        return null;

    }

}

function todaysTotalMTS() {
  const mtsProjectedEarnings = document.getElementById('mts-ht-earnings').textContent;
  return Number(mtsProjectedEarnings.replace(/[^0-9.]/g, ''));
}

function workerId() {

    const workerIdCopyElement = document.querySelector(`[data-react-class="require('reactComponents/common/CopyText')['default']"]`);
    return JSON.parse(workerIdCopyElement.dataset.reactProps).textToCopy;

}

function workerIdHash() {

    return sha256(workerId());

}

function userEarningsPayload() {

    const payload = JSON.stringify({
        idHash: workerIdHash(),
        date: lastWorkLoggedDateYYYYMMDD(),
        total: todaysTotal() || todaysTotalMTS(),
        clientVersion: globals.CLIENT_VERSION
    });

    return payload;

}

async function submitUserEarnings() {

    const apiEndpoint = `${globals.API_BASE}/store`;

    const responseStream = await fetch(apiEndpoint, {
        method: "POST",
        body: userEarningsPayload(),
        headers: {
            "Content-Type": "application/json"
        }
    });

    const response = await responseStream.json();
    return response;

}

function injectAveragePERow() {
    const el = document.getElementById("TodaysActivityAdditionalInfo") || document.getElementById('dashboard-available-earnings').querySelector('.border-gray-lightest').children[0];

    el.insertAdjacentHTML("beforebegin", `
        <div class="row m-b-sm">
            <div class="col-xs-7 col-sm-6 col-lg-7">
                <strong>Today's Community Average</strong>
            </div>
            <div class="col-xs-5 col-sm-6 col-lg-5 text-xs-right">
                <a id="retrieveCommunityAverage" href="javascript:void(0);">Retrieve Community Average</a>
            </div>
        </div>
        <div class="row m-b-sm">
            <div class="col-xs-7 col-sm-6 col-lg-7">
                <strong>TC Low, Med, High</strong>
            </div>
            <div class="col-xs-5 col-sm-6 col-lg-5 text-xs-right">
                <div id="tcLowMedHigh">&nbsp;</div>
            </div>
        </div>
        <div class="row m-b-sm">
            <div class="col-xs-7 col-sm-6 col-lg-7">
                <strong>Box+Whisker Plot</strong>
            </div>
            <div style="text-align: center;">
                <img id="boxplotImage" style="max-width: 270px;" src="">
            </div>
        </div>
        <div class="row m-b-sm">
            <div class="col-xs-7 col-sm-6 col-lg-7">
                <strong>TC Rank</strong>
            </div>
            <div class="col-xs-5 col-sm-6 col-lg-5 text-xs-right">
                <div id="rank"></div>
            </div>
        </div>
        <div class="row m-b-sm">
            <div class="col-xs-7 col-sm-6 col-lg-7">
                <strong>Nearest Competitor</strong>
            </div>
            <div class="col-xs-5 col-sm-6 col-lg-5 text-xs-right">
                <div id="nearestCompetitor"></div>
            </div>
        </div>
        <div class="row m-b-sm">
            <div class="col-xs-7 col-sm-6 col-lg-7">
                <strong>Leaderboard</strong>
            </div>
            <div class="col-xs-5 col-sm-6 col-lg-5 text-xs-right">
                <select id="leaderboard"></div>
            </div>
        </div>
    `);
}

function boxplotRenderUrl(params = {
    low: undefined,
    high: undefined,
    median: undefined,
    firstQuartile: undefined,
    thirdQuartile: undefined
}) {
    return (`http://www.imathas.com/stattools/boxplot.php?n=1&showlabels=0&title0=&ds0q0=${params.low.replace("$", "")}&ds0q1=${params.firstQuartile.replace("$", "")}&ds0q2=${params.median.replace("$", "")}&ds0q3=${params.thirdQuartile.replace("$", "")}&ds0q4=${params.high.replace("$", "")}&title1=&ds1q0=&ds1q1=&ds1q2=&ds1q3=&ds1q4=&title2=&ds2q0=&ds2q1=&ds2q2=&ds2q3=&ds2q4=&xmin=0&xmax=${Math.floor((+params.high.replace("$", "")) + 5)}&ticks=5&axistitle=&imgwidth=300&imgheight=120`);
}

function embedBoxAndWhiskerData(params = {
    low: undefined,
    high: undefined,
    median: undefined,
    firstQuartile: undefined,
    thirdQuartile: undefined}) {
    document.getElementById("tcLowMedHigh").dataset.boxAndWhiskerPoints = JSON.stringify(params);
    document.getElementById("boxplotImage").setAttribute("src", boxplotRenderUrl(params));
}

function rank(userEarnings, allUsersAscendingSortedEarnings) {

    return ( [...allUsersAscendingSortedEarnings].reverse().indexOf(userEarnings) + 1 );

}

function nearestCompetitorTotalAndGapTuple(userEarnings, allUsersAscendingSortedEarnings) {

    const hasCompetitors = ( allUsersAscendingSortedEarnings.length > 1 );
    if(!hasCompetitors) { return [userEarnings, 0]; }

    const userEarningsIndex = allUsersAscendingSortedEarnings.indexOf(userEarnings);

    const isLeader = ( userEarningsIndex === allUsersAscendingSortedEarnings.length - 1 );

    const tiedEarningsErrorFactor = 0.01;

    let nearestCompetitorEarnings;
    if(isLeader) {
        nearestCompetitorEarnings = [...allUsersAscendingSortedEarnings].reverse().find(earnings => {
            return earnings < ( userEarnings - tiedEarningsErrorFactor );
        });
    }
    else {
        nearestCompetitorEarnings = allUsersAscendingSortedEarnings.find(earnings => {
            return earnings > ( userEarnings + tiedEarningsErrorFactor );
        });
    }

    const nearestCompetitorGap = nearestCompetitorEarnings - userEarnings;

    return [nearestCompetitorEarnings, nearestCompetitorGap];
}

function displayRank(rank, numberOfPositions) {

    const relativeThresholdAtWhichToDisplayTopPercentile = 0.5;

    const topPercentileZeroToOne = ( 1 - ( (numberOfPositions - rank) / numberOfPositions ) );

    const formattedTopPercentile = topPercentileZeroToOne.toLocaleString("en-US", {style: "percent"});

    document.getElementById("rank").innerHTML = `# <strong>${rank}</strong> / ${numberOfPositions} ${topPercentileZeroToOne <= relativeThresholdAtWhichToDisplayTopPercentile ? `( Top <strong>${formattedTopPercentile}</strong> )` : ""}`;
}

function displayNearestCompetitorInfo(nearestCompetitorTotalAndGapTuple) {

    const [nearestCompetitorTotal, nearestCompetitorGap] = nearestCompetitorTotalAndGapTuple;

    const sign = ( nearestCompetitorGap >= 0 ? "+" : "-" );
    const color = ( sign === "+" ? "green" : "red" );
    const absoluteGap = Math.abs(nearestCompetitorGap);

    const [nearestCompetitorTotalFormatted, absoluteGapFormatted] = [nearestCompetitorTotal, absoluteGap].map(val => val.toLocaleString("en-US", {style: "currency", currency: "USD"}));

    document.getElementById("nearestCompetitor").innerHTML = `${nearestCompetitorTotalFormatted} ( <span style="color: ${color};">${sign} ${absoluteGapFormatted}</span> )`;

}

function leaderboardOptionElementsFrom(allUsersAscendingSortedEarnings) {
    const descendingEarnings = [...allUsersAscendingSortedEarnings].reverse();

    return descendingEarnings.map((earnings, index) => {
        return (`
            <option>[#${index+1}]: ${earnings.toLocaleString("en-US", {style: "currency", currency: "USD"})}</option>
        `);
    }).join("");
}

function displayLeaderboard(allUsersAscendingSortedEarnings) {
    document.getElementById("leaderboard").innerHTML = leaderboardOptionElementsFrom(allUsersAscendingSortedEarnings);
}

async function main() {

    injectAveragePERow();

    document.getElementById("retrieveCommunityAverage").addEventListener("click", async e => {

        const earningsApiResponse = await submitUserEarnings();

        if(exists(earningsApiResponse.averageEarningsForToday)) {

            const sortedIndividualEarnings = [...earningsApiResponse.individualEarningsForToday].sort((a,b) => a-b);

            const lowestIndividualEarnings = sortedIndividualEarnings[0].toLocaleString("en-US", {style: "currency", currency: "USD"});
            const medianIndividualEarnings = medianOfSortedValues(sortedIndividualEarnings).toLocaleString("en-US", {style: "currency", currency: "USD"});
            const highestIndividualEarnings = sortedIndividualEarnings[sortedIndividualEarnings.length-1].toLocaleString("en-US", {style: "currency", currency: "USD"});

            const [firstQuartile, thirdQuartile] = sidesOfMedian(sortedIndividualEarnings).map(side => medianOfSortedValues(side).toLocaleString("en-US", {style: "currency", currency: "USD"}));

            embedBoxAndWhiskerData({low: lowestIndividualEarnings,
                                    high: highestIndividualEarnings,
                                    median: medianIndividualEarnings,
                                    firstQuartile,
                                    thirdQuartile});

            document.getElementById("tcLowMedHigh").innerHTML = `
                <span style='color: red;'>${lowestIndividualEarnings}</span>,
                <span style='color: orange;'>${medianIndividualEarnings}</span>,
                <span style='color: green;'>${highestIndividualEarnings}</span>`;

            e.target.innerText = earningsApiResponse.averageEarningsForToday.toLocaleString("en-US", {style: "currency", currency: "USD"});

            const total = ( todaysTotal() || todaysTotalMTS() );

            displayRank( rank(total, sortedIndividualEarnings), sortedIndividualEarnings.length );
            displayNearestCompetitorInfo( nearestCompetitorTotalAndGapTuple(total, sortedIndividualEarnings) );
            displayLeaderboard( sortedIndividualEarnings );

        }
        else if(["Your request is missing fields: total", "Your report is outdated"].includes(earningsApiResponse.errorMessage)) {
            e.target.innerText = "Work before comparing!";
        }
        else {
            e.target.innerText = earningsApiResponse.errorMessage;
        }

    });
}

main();
This isn't my script. Kad said it was safe.
 

Rogue and Ready

Well-Known Member
Contributor
Joined
Dec 30, 2017
Messages
2,261
Reaction score
2,439
Points
588
Location
Gold Beach Oregon
Gender
Female
Title: Research Participation: Workplace Experiences(~ 10 minutes) | Accept
Requester: Anna Chen [AVJYR0VQM15DO] Contact
TV: [Hrly=$7.27] [Pay=3.00] [Fast=null] [Comm=null] [Rej=0] [ToS=0] [Blk=0]
TO: [Pay=4.17] [Fast=5.00] [Comm=5.00] [Fair=5.00] [Reviews=7] [ToS=0]
TO2: [Hrly=6.68] [Pen=0.04 days] [Res=null] [Rec=100%] [Rej=0] [ToS=0] [Brk=0]
Reward: 1.00
Duration: 1800
Available: 10
Description: The purpose of this study is to understand how people react in social interactions. This online study consists of (1) answering a list of questions about yourself, (2) recalling a social interaction episode, and (3) responding to some questions based on the episode. It will take about 12 minutes to complete.
Qualifications: Total approved HITs GreaterThanOrEqualTo 100; Exc: [-1064378168-106842] DoesNotExist ; HIT approval rate (%) GreaterThanOrEqualTo 98; Location In US
[tr][td]
HIT exported from Mturk Suite v2.3.12
[/td][/tr]
[tr][td]
.[/td][/tr]
 

C to the J

Outlaw Turker
Contributor
Master Pleaser
Crowd Pleaser
HIT Poster
Joined
Jan 12, 2016
Messages
52,826
Reaction score
163,422
Points
3,238
Age
37
Gender
Male
Title: Answer a survey about conflict in the workplace | Accept
Requester: Medha Raj [A3SE8GZPSVKQWO] Contact
TV: [Hrly=$11.14] [Pay=3.54] [Fast=null] [Comm=null] [Rej=0] [ToS=0] [Blk=0]
TO: [Pay=3.72] [Fast=4.83] [Comm=3.89] [Fair=4.87] [Reviews=81] [ToS=2]
Reward: 0.30
Duration: 3600
Available: 1
Description: Give us your opinion about this situation
Qualifications: Total approved HITs GreaterThanOrEqualTo 1000; HIT approval rate (%) GreaterThanOrEqualTo 95; Location EqualTo US
[tr][td]
HIT exported from Mturk Suite v2.3.11
[/td][/tr]
[tr][td]
s[/td][/tr]
 

Rogue and Ready

Well-Known Member
Contributor
Joined
Dec 30, 2017
Messages
2,261
Reaction score
2,439
Points
588
Location
Gold Beach Oregon
Gender
Female
Title: 10-minute survey about online behavior, must have a Gmail/Google Account | Accept
Requester: Awesome UER [A2XIUY9EMRF1BP] Contact
TV: [Hrly=$17.97] [Pay=4.48] [Fast=5.00] [Comm=null] [Rej=0] [ToS=0] [Blk=0]
TO: [Pay=4.26] [Fast=4.90] [Comm=1.00] [Fair=5.00] [Reviews=29] [ToS=0]
TO2: [Hrly=12.44] [Pen=1.50 days] [Res=null] [Rec=100%] [Rej=0] [ToS=0] [Brk=1]
Reward: 2.00
Duration: 3600
Available: 5
Description: -
Qualifications: Total approved HITs GreaterThanOrEqualTo 1; HIT approval rate (%) GreaterThanOrEqualTo 90; Location EqualTo US
[tr][td]
HIT exported from Mturk Suite v2.3.12
[/td][/tr]
[tr][td]
/[/td][/tr]
 

masterx1234

Well-Known Member
Contributor
Joined
Oct 10, 2017
Messages
1,470
Reaction score
2,968
Points
588
Age
34
Gender
Male
Hows mturk going today guys? I got on late because I couldnt sleep because of the storms last night. were getting the leftovers from Hurricane Florence.
 
  • Like
Reactions: CrazyCatLady

Kliq

Well-Known Member
Joined
Mar 14, 2016
Messages
2,064
Reaction score
6,914
Points
763
Gender
Male
Title: Research Participation: Workplace Experiences(~ 10 minutes) | Accept
Requester: Anna Chen [AVJYR0VQM15DO] Contact
TV: [Hrly=$7.27] [Pay=3.00] [Fast=null] [Comm=null] [Rej=0] [ToS=0] [Blk=0]
TO: [Pay=4.17] [Fast=5.00] [Comm=5.00] [Fair=5.00] [Reviews=7] [ToS=0]
TO2: [Hrly=6.68] [Pen=0.04 days] [Res=null] [Rec=100%] [Rej=0] [ToS=0] [Brk=0]
Reward: 1.00
Duration: 1800
Available: 10
Description: The purpose of this study is to understand how people react in social interactions. This online study consists of (1) answering a list of questions about yourself, (2) recalling a social interaction episode, and (3) responding to some questions based on the episode. It will take about 12 minutes to complete.
Qualifications: Total approved HITs GreaterThanOrEqualTo 100; Exc: [-1064378168-106842] DoesNotExist ; HIT approval rate (%) GreaterThanOrEqualTo 98; Location In US
[tr][td]
HIT exported from Mturk Suite v2.3.12
[/td][/tr]
[tr][td]
.[/td][/tr]
Writing in the middle.
 
  • Like
Reactions: Rogue and Ready

C to the J

Outlaw Turker
Contributor
Master Pleaser
Crowd Pleaser
HIT Poster
Joined
Jan 12, 2016
Messages
52,826
Reaction score
163,422
Points
3,238
Age
37
Gender
Male
Title: Short opinions survey(~ 4 minutes) | Accept
Requester: EDJI Lab [A2F5H2H6PIJQWH] Contact
TV: [Hrly=$10.24] [Pay=3.36] [Fast=null] [Comm=null] [Rej=0] [ToS=0] [Blk=0]
TO: [Pay=3.00] [Fast=4.61] [Comm=3.30] [Fair=4.47] [Reviews=59] [ToS=0]
Reward: 0.40
Duration: 1800
Available: 1
Description: Give your opinions on how warm or cold you feel towards certain groups
Qualifications: HIT approval rate (%) GreaterThanOrEqualTo 80; Location In US
[tr][td]
HIT exported from Mturk Suite v2.3.11
[/td][/tr]
[tr][td]
x[/td][/tr]
 
Status
Not open for further replies.