js/myaction.js
/* Get the entire list of useractions(disregarding timestamps) and appends
them to the page. Also resets the action arrays. */
Get the entire list of useractions(disregarding timestamps) and appends
them to the page. Also resets the action arrays.
Get the entire list of useractions ( disregarding timestamps ) and appends them to the page . Also resets the action arrays .
function update_my_action_table(data) {
    $("#my_action_content").empty();
    $("#score_content").empty();
    myAction = [];
    pointRecord= [];
    categoryRecord= [];
    list=[];
    nameRecord=[];
    sum = 0;
    actionCounter = 0;
    for (action of data) {
        var submissionStatus = '<p style="font-size:18px; color:black;visibility:hidden">Submission Time: </p>';
        var cooldownStatus = '<p style="font-size:40px; color:black">Cooldown: 1 day</p>';
        var cooldownIcon = $('<img src="images/hourglass.svg" style="color:black;position:relative;z-index:2;" height="150px" width="150px">'); 
        if (action['CompleteTime'] == null)
        {
            cooldownIcon.css("visibility","hidden"); 
            cooldownStatus = '<p class="submit-text" style="color:black">Ready to submit!</p>';
        }
        var userAction = $(
            '<div class="col-lg-4 text-center">'
            + '<div class="panel panel-default" >'
            + '<div class ="challenge_box">'
            + '<div  class ="row">'
            + '<img src="/images/categories/'+ action['Category'] + '.png" alt="" class ="challenge_img">'
            + '<p class ="challenge_name col-sm-7" style="text-align:left;">'+ action['Description'] + '</p>'
            + '<p class ="label label-danger col-sm-3" style="font-size:1em;margin-left:2%;">Points: ' + action['Points'] +'</p>' 
            + '</div>'
            + '<div class ="row">'
            + '<img src="images/check1.svg" height="50px" width="50px" class ="challenge_check" id = "'+ action['ActionID'] + '" onclick="finishAction(\''+ action['ActionID'] + '\')">'
            + '</div>'
            + cooldownIcon.prop("outerHTML") 
            + cooldownStatus
            + '</div>'
            + submissionStatus
            + '</div>'
            + '</div>'
        );
        if (action['CompleteTime'] == null)
        {
            userAction.css("color", "black");
        }
        $("#my_action_content").append(userAction)
        myAction[action['ActionID']] = 1;
        list.push(action['ActionID']);
        pointRecord[action['ActionID']] = action['Points'];
        nameRecord[action['ActionID']] = action['Description'];
        categoryRecord[action['ActionID']] = action['Category'];
        actionCounter = actionCounter+1;
        get_num_action();
    }
    check_myAction_status();
    update_my_current_pick();
}
function update_my_action_table ( data ) { $ ( "#my_action_content" ) . empty ( ) ; $ ( "#score_content" ) . empty ( ) ; myAction = [ ] ; pointRecord = [ ] ; categoryRecord = [ ] ; list = [ ] ; nameRecord = [ ] ; sum = 0 ; actionCounter = 0 ; for ( action of data ) { var submissionStatus = '<p style="font-size:18px; color:black;visibility:hidden">Submission Time: </p>' ; var cooldownStatus = '<p style="font-size:40px; color:black">Cooldown: 1 day</p>' ; var cooldownIcon = $ ( '<img src="images/hourglass.svg" style="color:black;position:relative;z-index:2;" height="150px" width="150px">' ) ; if ( action [ 'CompleteTime' ] == null ) { cooldownIcon . css ( "visibility" , "hidden" ) ; cooldownStatus = '<p class="submit-text" style="color:black">Ready to submit!</p>' ; } var userAction = $ ( '<div class="col-lg-4 text-center">' + '<div class="panel panel-default" >' + '<div class ="challenge_box">' + '<div  class ="row">' + '<img src="/images/categories/' + action [ 'Category' ] + '.png" alt="" class ="challenge_img">' + '<p class ="challenge_name col-sm-7" style="text-align:left;">' + action [ 'Description' ] + '</p>' + '<p class ="label label-danger col-sm-3" style="font-size:1em;margin-left:2%;">Points: ' + action [ 'Points' ] + '</p>' + '</div>' + '<div class ="row">' + '<img src="images/check1.svg" height="50px" width="50px" class ="challenge_check" id = "' + action [ 'ActionID' ] + '" onclick="finishAction(\'' + action [ 'ActionID' ] + '\')">' + '</div>' + cooldownIcon . prop ( "outerHTML" ) + cooldownStatus + '</div>' + submissionStatus + '</div>' + '</div>' ) ; if ( action [ 'CompleteTime' ] == null ) { userAction . css ( "color" , "black" ) ; } $ ( "#my_action_content" ) . append ( userAction ) myAction [ action [ 'ActionID' ] ] = 1 ; list . push ( action [ 'ActionID' ] ) ; pointRecord [ action [ 'ActionID' ] ] = action [ 'Points' ] ; nameRecord [ action [ 'ActionID' ] ] = action [ 'Description' ] ; categoryRecord [ action [ 'ActionID' ] ] = action [ 'Category' ] ; actionCounter = actionCounter + 1 ; get_num_action ( ) ; } check_myAction_status ( ) ; update_my_current_pick ( ) ; }
Get the entire list of useractions(disregarding timestamps) and appends
them to the page.
Get the entire list of useractions ( disregarding timestamps ) and appends them to the page .
// submitted actions cannot be changed, instead displays submitted time &  // a big hourglass icon over the action // userActions by default has CompleteTime null, // resets submissionStatus & cooldownIcon to allow user to submit again //make text bigger for no timestamped actions! // submissionStatus.css("visibility","hidden"); //i'd use this for submission Status but it's too cramped //hidden but the space is still there //return jquery obj as html string // if userAction has no timestamp (can be submitted), set it black