List job applications as freelancer, what does the output field 'status: Current status of the job application' ints map to? - upwork-api

The Upwork API documentation shows that the 'List job applications as freelancer' endpoint returns an 'output field' called 'status'. I can confirm that the value returned is typically a string with a value of 2-9. I am trying to understand what these values map to.
The only plausible solution I have found is the 'List Reasons' endpoint, though the mapping does not really make sense in a few of the cases I looked at.
Does anyone know what the status codes returned by the List job applications as freelancer endpoint map to?
Thanks a million!

The statuses should correspond to the following values:
Created = 1 // deprecated
Accepted = 2
Declined = 3
Withdrawn = 4
Replaced = 5 // deprecated
Offered = 6
Activated = 7
Archived = 8
Rejected = 9 // deprecated
Hired = 10
Pending = 11
Invalid = 12

Related

How to write a Go/Gin general function of 14 behaviors, and then call or check it in a certain place?

There are nearly 14 behaviors of sending points to users, such as user registration, login, purchase, and chat. It is required not to change the previous interface code in Go.
id
motion
points
remark
1
/register
5
one user only have one chance to get points
2
/login
5
every day the user has one chance to get points
3
/comment
3
every day the user has five chance to get points
4
/pay
10
every day the user has three chance to get points
5
/invite
10
every day the user has three chance to get points
6
/send
10
every day the user has three chance to get points
7
/purchase
10
every day the user has three chance to get points
Every day the user only has 100 points
Through the following partial code of /register every user can get 5 points after he registers successfully.
func (r *User) CreateUser(CreateUser *CreateUserModel, c *lmhttp.Context) {
err = r.userDB.insertScoreTx(CreateUser.UserID, 1, 5)
if err != nil {
r.Error("Send points failed", zap.Error(err))
c.ResponseError(errors.New("Send points failed"))
return
}
c.Response(LoginUserDetail(UserModel, token, r.ctx))
}
And the data of table user_points is as below:
id
user_id
points
points_type
1
1
5
1
Can I write a general function of sending points, and then call or check it in a certain place, that is, judge whether to increase points when each interface request is successful, such as the following places where each interface responds successfully?
// Response OK
func (c *Context) ResponseOK() {
c.JSON(http.StatusOK, gin.H{
"status": http.StatusOK,
})
}
Thanks so much for any advice
You can definitely do what you're asking. I don't know Go but some webservers will have a hook to run a function on every successful request. In that function based on the URL you can check if to add points for the user. You are already storing the type of points but you also need to store how many chances they used up for the day.
Then you can write the logic for whether they add points for each of the rules.
If in Go there is no hook function that runs on any request you can go as basic as a function that takes in e.g 'register', 'login'. And call it manually from everywhere you handle the requests you wanna add points for.
You also need to reset the data based on the date since all the rules are "today".
My best advice for that is to also store the current date on all the user_points entries. And when checking whether to add points if the current day is not today you set the number of used up chances to 1 and the date to current.
e.g table
id
user_id
points
points_type
chances_used
date
1
1
5
1
2
14:33 09/02/2023
e.g logic from inside the function:
if type == 'comment':
points = db.get(user_points).filter(user.id=1, points_type=3)
if points.date == date.today():
points.chances_used += 1
if points.chances_used < 5
user.points += 3
if points.date < date.today():
points.chances_used = 1
points.date = date.now()
user.points += 3
Though thinking about it now this means you would lose record of where a users points came from because I am using user.points to store the actual value.
You might wanna just add a row to the table every-time you check instead. And get the data instead of something like db.get(user_points).filter(user.id=1, points_type=3), just get the users latest for that point_type. And use that row to check the date and get the chances_used but save your data into a new row.
You could create a dedicated struct or function to handle scores. From what I see in the code in order to apply points to the user you would need to pass a few information such as userDB, UserId, points_type and points, the same what you already have in the code. If you want the function to be stateless and available everywhere you can define it in dedicated userpoints package and simply export:
func SendPointsTo(db userDB, userId, pointsType, pointsCount int) error {
err := d.insertScoreTx(userId, pointsType, pointsCount )
if err != nil {
return errors.New("Sending points failed")
}
return nil
}
Don't mix logic of creating user with some other actions - it introduces confusion and breaks SRP. It's better to make a dedicated createUserHandler which performs chains of steps defined by the contract. A part of the contract would then be additional SendPointsTo func call.
Is it what you mean? If not can you be more preciseful in problem definition?

How do you create a new column based on Max value of 1 column and Category of another?

I am working with a bunch of data for my job creating status reports on the documents that we are working through that we then assign to an area. We decided to use PowerBI as an interactive way to see where everything is at.
Using Power BI Desktop I've created a new table that excludes documents that are not ready for QC but we have several different statuses. Instead of creating a new table for each status type (since some can be grouped together) I would like to create a new column that has the grouped status value's Max for each area. The higher the Status Value the further it is from being complete.
EX:
Record:
Area:
Status Value:
Max Status Value:
152385
A
1
2
354354
B
2
3
131322
B
3
3
132136
A
2
2
213513
A
1
2
351315
B
2
3
If anyone knows how to get the Max Status Value column that would greatly help. I did find another post (https://community.powerbi.com/t5/Desktop/LOOKUPVALUE-return-min-max-of-values-found/td-p/657534) that was similar but I'm still new to DAX and could not figure out how to apply it to my situation.
This post actually helped me answer the question.
https://community.powerbi.com/t5/Power-Query/Maxifs-Power-Query/m-p/1693606
The only difference I made was getting rid of the true/false portion to receive my results. Thus my result was:
Max Status Value =
VAR vMaxVal=
CALCULATE (
MAX ( 'Table'[Status Value] ),
ALLEXCEPT (
'Table',
'Table'[Area]
)
)
RETURN
vMaxVal

Google sheets : Is there a way to prevent duplicate month entries?

I am setting up a template in Google sheets where I need a user to enter upto 12 months balance information. Each of the 12 months should be different without any repetition. I would like to restrict the user from entering same months again as input. Is there a way to prevent entry of duplicate months? I can restrict duplicate dates using data validation but can't seem to figure out for months.Thanks!
There are many ways:
if you want to use formula you can use =MONTH() in conjuction with =IF()
=MONTH(A1) will return a month of the cell A1
=IF(MONTH(A1 = 7), TRUE, FALSE) will return TRUE if month in A1 is 7
if you want to use Apps Script (JS) you could try these functions:
Array.prototype.includes()
// edit your logic here
const monthsDone = [1,2,3,4];
if (monthsDone.includes(4)) Logger.log('Sorry, this month already exists')
Array.prototype.some()
const monthsDone = [1,2,3,4];
const myMatch = (month) => month === 4;
monthsDone.some(myMatch) // returns true if 4 exists
String.prototype.match()
RegExp.prototype.test()
Array.prototype.indexOf()

Xeroizer::ApiException : QueryParseException: No property or field 'inv_id' exists

I am Trying to get all the invoices in a single API hit.
Because, for every user having 100's of invoices.
It will exceed the API limit (Minute Limit: 60 calls in a rolling 60 second window).
I am trying to store all the invoice id into a single array and from that i will get the details of the user and then i loop the records locally and display it. It's the right way?
invoice_ids = user.estimates.select("invoice_id") || [] xero = Xeroizer::PrivateApplication.new(XERO_CONFIG["key"], XERO_CONFIG["secret"], XERO_CONFIG["path"], :rate_limit_sleep => 5)
invoices = ['795f789b-5958-xxxx-yyyy-48436dbe7757','987g389b-5958-xxxx-yyyy-68636dbe5589']
inv_id = invoice_ids.pluck(:invoice_id)
invoices = xero.Invoice.all(:where => 'InvoiceID==inv_id')
Also, I am getting the following error:
Xeroizer::ApiException (QueryParseException: No property or field 'inv_id' exists in type 'Invoice')
Looks like the problem is that you're not interpolating the inv_ids correctly. You probably need to do something like this:
invoices = xero.Invoice.all(:where => "InvoiceID==\"#{inv_id}\"")
You may have to perform some additional formatting on the inv_id variable to make it a valid Xero string. https://github.com/waynerobinson/xeroizer#retrieving-data

Check if input field is empty or not

I have 10 textboxes x 3 so about 30.
Name - Age - SEx
so 10 persons in all.
I have this current code:
if(array_key_exists('submit',$_POST)){ //CHECKS IF FORM WAS SUBMITTED, ELSE LOADS TO VIEW
for($counter=1;$counter<11;$counter++){ //I LOOPED THE 10 FIELDS, STARTING FROM 1, 1-10
if($_POST['ingredient'.$counter]!=null){ // CHECK IF ATLEAST NAME IS NOT EMPTY, IF EMPTY EVEN IF THE OTHER 2 INPUTS ARE NOT I WILL NOT INCLUDE IT.
$this->form_validation->set_rules('Name'.$counter,'Name #'.$counter,'trim');
$this->form_validation->set_rules('Age'.$counter,'Age of'.$_POST['name'.$counter],'trim|required|numeric');
$this->form_validation->set_rules('Sex'.$counter,'Gender of'.$_POST['name'.$counter],'trim|required');
}
Im only adding required on the other 2 fields since name shouldnt be null to be inside the if(success){ } clause
Is there any other better way?
CALLBACK QUESTIONS.
When using form_validation, say i used a callback function. how would i be able to print the necessary error_message for that callback since ci wont be able to know what that function was all about.

Resources