Subversion Repositories SmartDukaan

Rev

Rev 11017 | Rev 11095 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11017 Rev 11076
Line 15... Line 15...
15
    MarketplaceItems as TMarketplaceItems, MarketplacePercentage as TMarketplacePercentage, \
15
    MarketplaceItems as TMarketplaceItems, MarketplacePercentage as TMarketplacePercentage, \
16
    MarketPlaceItemPrice as TMarketPlaceItemPrice, FlipkartItem as TFlipkartItem,\
16
    MarketPlaceItemPrice as TMarketPlaceItemPrice, FlipkartItem as TFlipkartItem,\
17
    FlipkartItemDetails as TFlipkartItemDetails, MarketplaceHistory as TMarketplaceHistory
17
    FlipkartItemDetails as TFlipkartItemDetails, MarketplaceHistory as TMarketplaceHistory
18
from shop2020.utils.Utils import to_java_date
18
from shop2020.utils.Utils import to_java_date
19
 
19
 
-
 
20
 
20
def to_t_item(item):
21
def to_t_item(item):
21
    t_item = Item()
22
    t_item = Item()
22
    if item is None:
23
    if item is None:
23
        return t_item
24
        return t_item
24
    t_item.id = item.id
25
    t_item.id = item.id
Line 416... Line 417...
416
    if marketplaceHistory is None:
417
    if marketplaceHistory is None:
417
        return t_marketplace_history
418
        return t_marketplace_history
418
    t_marketplace_history.item_id = marketplaceHistory.item_id
419
    t_marketplace_history.item_id = marketplaceHistory.item_id
419
    t_marketplace_history.source = marketplaceHistory.source
420
    t_marketplace_history.source = marketplaceHistory.source
420
    t_marketplace_history.timestamp = to_java_date(marketplaceHistory.timestamp)
421
    t_marketplace_history.timestamp = to_java_date(marketplaceHistory.timestamp)
-
 
422
    if marketplaceHistory.lowestPossibleTp is None:
-
 
423
        t_marketplace_history.lowest_possible_tp =0
-
 
424
    else:
421
    t_marketplace_history.lowest_possible_tp = marketplaceHistory.lowestPossibleTp
425
        t_marketplace_history.lowest_possible_tp = int(marketplaceHistory.lowestPossibleTp)
-
 
426
    if marketplaceHistory.lowestPossibleSp is None:
-
 
427
        t_marketplace_history.lowest_possible_sp = 0
-
 
428
    else:
422
    t_marketplace_history.lowest_possible_sp = marketplaceHistory.lowestPossibleSp
429
        t_marketplace_history.lowest_possible_sp = int(marketplaceHistory.lowestPossibleSp)
423
    t_marketplace_history.ourInventory = marketplaceHistory.ourInventory
430
    t_marketplace_history.ourInventory = marketplaceHistory.ourInventory
424
    t_marketplace_history.otherInventory = marketplaceHistory.otherInventory
431
    t_marketplace_history.otherInventory = marketplaceHistory.otherInventory
425
    t_marketplace_history.secondLowestInventory = marketplaceHistory.secondLowestInventory
432
    t_marketplace_history.secondLowestInventory = marketplaceHistory.secondLowestInventory
426
    t_marketplace_history.ourRank = marketplaceHistory.ourRank
433
    t_marketplace_history.ourRank = marketplaceHistory.ourRank
-
 
434
    if marketplaceHistory.ourOfferPrice is None:
-
 
435
        t_marketplace_history.ourOfferPrice = 0
-
 
436
    else: 
427
    t_marketplace_history.ourOfferPrice = marketplaceHistory.ourOfferPrice
437
        t_marketplace_history.ourOfferPrice = int(marketplaceHistory.ourOfferPrice)
-
 
438
    if marketplaceHistory.ourSellingPrice is None:
-
 
439
        t_marketplace_history.ourSellingPrice = 0
-
 
440
    else:
428
    t_marketplace_history.ourSellingPrice = marketplaceHistory.ourSellingPrice
441
        t_marketplace_history.ourSellingPrice = int(marketplaceHistory.ourSellingPrice)
-
 
442
    if marketplaceHistory.ourTp is None:
-
 
443
        t_marketplace_history.ourTp = 0
-
 
444
    else:
429
    t_marketplace_history.ourTp = marketplaceHistory.ourTp
445
        t_marketplace_history.ourTp = int(marketplaceHistory.ourTp)
-
 
446
    if marketplaceHistory.ourNlc is None:
-
 
447
        t_marketplace_history.ourNlc = 0
-
 
448
    else:
430
    t_marketplace_history.ourNlc = marketplaceHistory.ourNlc
449
        t_marketplace_history.ourNlc = int(marketplaceHistory.ourNlc)
431
    t_marketplace_history.competitiveCategory = marketplaceHistory.competitiveCategory
450
    t_marketplace_history.competitiveCategory = marketplaceHistory.competitiveCategory
432
    t_marketplace_history.risky = marketplaceHistory.risky
451
    t_marketplace_history.risky = marketplaceHistory.risky
-
 
452
    if marketplaceHistory.lowestOfferPrice is None:
-
 
453
        t_marketplace_history.lowestOfferPrice = 0
-
 
454
    else:
433
    t_marketplace_history.lowestOfferPrice = marketplaceHistory.lowestOfferPrice
455
        t_marketplace_history.lowestOfferPrice = int(marketplaceHistory.lowestOfferPrice)
-
 
456
    if marketplaceHistory.lowestSellingPrice is None:
-
 
457
        t_marketplace_history.lowestSellingPrice = 0
-
 
458
    else:
434
    t_marketplace_history.lowestSellingPrice = marketplaceHistory.lowestSellingPrice
459
        t_marketplace_history.lowestSellingPrice = int(marketplaceHistory.lowestSellingPrice)
-
 
460
    if marketplaceHistory.lowestTp is None:
-
 
461
        t_marketplace_history.lowestTp = 0
-
 
462
    else:
435
    t_marketplace_history.lowestTp = marketplaceHistory.lowestTp
463
        t_marketplace_history.lowestTp = int(marketplaceHistory.lowestTp)
436
    if marketplaceHistory.lowestSellerName is None:
464
    if marketplaceHistory.lowestSellerName is None:
437
        t_marketplace_history.lowestSellerName = ''
465
        t_marketplace_history.lowestSellerName = ''
438
    else:
466
    else:
439
        t_marketplace_history.lowestSellerName = marketplaceHistory.lowestSellerName
467
        t_marketplace_history.lowestSellerName = marketplaceHistory.lowestSellerName
-
 
468
    if marketplaceHistory.proposedSellingPrice is None:
-
 
469
        t_marketplace_history.proposedSellingPrice = 0
-
 
470
    else:
440
    t_marketplace_history.proposedSellingPrice = marketplaceHistory.proposedSellingPrice
471
        t_marketplace_history.proposedSellingPrice = int(marketplaceHistory.proposedSellingPrice)
-
 
472
    if marketplaceHistory.proposedTp is None:
-
 
473
        t_marketplace_history.proposedTp = 0
-
 
474
    else:
441
    t_marketplace_history.proposedTp = marketplaceHistory.proposedTp
475
        t_marketplace_history.proposedTp = int(marketplaceHistory.proposedTp)
-
 
476
    if marketplaceHistory.targetNlc is None:
-
 
477
        t_marketplace_history.targetNlc = 0
-
 
478
    else:
442
    t_marketplace_history.targetNlc = marketplaceHistory.targetNlc
479
        t_marketplace_history.targetNlc = int(marketplaceHistory.targetNlc)
443
    t_marketplace_history.salesPotential = marketplaceHistory.salesPotential
480
    t_marketplace_history.salesPotential = marketplaceHistory.salesPotential
444
    if marketplaceHistory.secondLowestSellerName is None:
481
    if marketplaceHistory.secondLowestSellerName is None:
445
        t_marketplace_history.secondLowestSellerName = ''
482
        t_marketplace_history.secondLowestSellerName = ''
446
    else:
483
    else:
447
        t_marketplace_history.secondLowestSellerName = marketplaceHistory.secondLowestSellerName
484
        t_marketplace_history.secondLowestSellerName = marketplaceHistory.secondLowestSellerName
448
    if marketplaceHistory.secondLowestSellingPrice is None:
485
    if marketplaceHistory.secondLowestSellingPrice is None:
449
        t_marketplace_history.secondLowestSellingPrice=0.0
486
        t_marketplace_history.secondLowestSellingPrice=0
450
    else:
487
    else:
451
        t_marketplace_history.secondLowestSellingPrice = marketplaceHistory.secondLowestSellingPrice
488
        t_marketplace_history.secondLowestSellingPrice = int(marketplaceHistory.secondLowestSellingPrice)
452
    if marketplaceHistory.secondLowestOfferPrice is None:
489
    if marketplaceHistory.secondLowestOfferPrice is None:
453
        t_marketplace_history.secondLowestOfferPrice = 0.0
490
        t_marketplace_history.secondLowestOfferPrice = 0
454
    else:
491
    else:
455
        t_marketplace_history.secondLowestOfferPrice = marketplaceHistory.secondLowestOfferPrice
492
        t_marketplace_history.secondLowestOfferPrice = int(marketplaceHistory.secondLowestOfferPrice)
456
    if marketplaceHistory.secondLowestTp is None:
493
    if marketplaceHistory.secondLowestTp is None:
457
        t_marketplace_history.secondLowestTp=0.0
494
        t_marketplace_history.secondLowestTp=0
458
    else:
495
    else:
459
        t_marketplace_history.secondLowestTp = marketplaceHistory.secondLowestTp
496
        t_marketplace_history.secondLowestTp = int(marketplaceHistory.secondLowestTp)
460
    t_marketplace_history.marginIncreasedPotential = marketplaceHistory.marginIncreasedPotential
497
    t_marketplace_history.marginIncreasedPotential = marketplaceHistory.marginIncreasedPotential
-
 
498
    if marketplaceHistory.margin is None:
-
 
499
        t_marketplace_history.margin = 0
-
 
500
    else:
461
    t_marketplace_history.margin = marketplaceHistory.margin
501
        t_marketplace_history.margin = int(marketplaceHistory.margin)
462
    t_marketplace_history.ourEnoughStock = marketplaceHistory.ourEnoughStock
502
    t_marketplace_history.ourEnoughStock = marketplaceHistory.ourEnoughStock
463
    t_marketplace_history.totalSeller = marketplaceHistory.totalSeller
503
    t_marketplace_history.totalSeller = marketplaceHistory.totalSeller
464
    t_marketplace_history.averageSale = marketplaceHistory.avgSales
504
    t_marketplace_history.averageSale = marketplaceHistory.avgSales
465
    t_marketplace_history.toGroup = marketplaceHistory.toGroup
505
    t_marketplace_history.toGroup = marketplaceHistory.toGroup
-
 
506
    t_marketplace_history.decision = marketplaceHistory.decision
-
 
507
    t_marketplace_history.reason = marketplaceHistory.reason
466
    return t_marketplace_history
508
    return t_marketplace_history
467
    
509
    
468
        
510