خرید بک لینک

Vote count: 0

I would like to identity incoming data and needs to apply exactly the same color for the same.

Data sequence is in fixed order (but all may be present or not) and need to apply fixed color mentioned like below.

For e.g. my data sequence and color sequence is like below:

CLOSED           GREEN
VERIFIED         GREEN
RESOLVED         YELLOW
REOPENED         RED
IN_PROGRESS      BLUE
ASSIGNED         BROWN
NEW              BROWN
UNCONFIRMED      BROWN

So whenever CLOSED comes GREEN color should be applied, for RESOLVED -> YELLOW and .... for UNCONFIRMED -> BROWN.

Now the problem is all data may come and may not come for e.g.

CLOSED
VERIFIED
IN_PROGRESS
UNCONFIRMED

So written basic logic in Java script like:

if ( jsonData.search("CLOSED") != -1 
   && jsonData.search("VERIFIED") != -1 
   && jsonData.search("IN_PROGRESS") != -1 ) {

   colors: ['green', 'green', 'blue', 'brown'],

} else if (jsonData.search("CLOSED") != -1 
   || jsonData.search("VERIFIED") != -1) {

   colors: ['green', 'green', 'blue', 'brown'],
}

This will work for above sequence but whenever data would be different for e.g.

IN_PROGRESS
ASSIGNED

Then this will fail and apply wrong color to first two data and the same problem if data would be like:

RESOLVED
REOPENED
NEW

If i write condition of each and every data and respective sequence then i will become mad and its completely ineffective and very complex logic too.

Can someone thinks about effective logic rather than writing individual data+color for exact sequence like mentioned?

Please let me know if any questions or i missed anything.

asked 53 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 9 مرداد 1395 ساعت: 16:40

صفحه بندی