
well its a combination of a couple sql tricks. the first sets the canearn flag to 1 or 0 (true or false, but it gets typecasted to int because thats the column type) based on the activity date.
the second multiplies your credits against that flag... if you can earn credits, then its 1 * your credits = your credits stay the same. if you cant earn credits, then its 0 = your credits are now 0.