Advertisement
Guest User

Untitled

a guest
Nov 25th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. func recombineOutgoing(){
  2.  
  3.  
  4. outgoingUnreadedTotal = 0
  5. if sessionListModel.lastLoaded != nil && outgoingQuestionModel.lastLoaded != nil{
  6.  
  7. var _tmpInactArray:[Any] = []
  8. var _tmpArray:[Any] = []
  9.  
  10. for item in outgoingQuestionModel.content!.list!{
  11. // if item.active ?? false == true{
  12. _tmpArray.append(item)
  13. // }else{
  14. // _tmpInactArray.append(item)
  15. // }
  16. if item.unreadCount ?? 0 > 0{
  17.  
  18. outgoingUnreadedTotal = outgoingUnreadedTotal + ( item.unreadCount ?? 0)
  19.  
  20. }
  21. }
  22.  
  23.  
  24. for item in sessionListModel.content!.items!{
  25. if item.question == nil && item.direction! == .outgoing{
  26. if item.active ?? false == true{
  27. _tmpArray.append(item)
  28. }else{
  29. _tmpInactArray.append(item)
  30. }
  31. if item.unreadCount ?? 0 > 0{
  32. outgoingUnreadedTotal = outgoingUnreadedTotal + ( item.unreadCount ?? 0)
  33. }
  34.  
  35. }
  36. }
  37.  
  38. _tmpArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
  39.  
  40. _tmpInactArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
  41.  
  42. combinedOutgoingArray = _tmpArray
  43. combinedIncomingInactiveArray = _tmpInactArray
  44.  
  45.  
  46.  
  47. }
  48.  
  49.  
  50.  
  51. updateView()
  52.  
  53. }
  54. func recombineIncoming(){
  55.  
  56. //......fuck fuck fuck fuck
  57. incomingUnreadedTotal = 0
  58. if sessionListModel.lastLoaded != nil && incomingQuestionModel.lastLoaded != nil{
  59.  
  60. var _tmpInactArray:[Any] = []
  61. var _tmpArray:[Any] = []
  62.  
  63.  
  64.  
  65.  
  66. for item in sessionListModel.content!.items!{
  67. if item.direction! == .incoming{
  68. if item.active ?? false == true{
  69. _tmpArray.append(item)
  70. }else{
  71. _tmpInactArray.append(item)
  72. }
  73.  
  74. if item.unreadCount ?? 0 > 0{
  75. incomingUnreadedTotal = incomingUnreadedTotal + ( item.unreadCount ?? 0)
  76. }
  77.  
  78. }
  79. }
  80.  
  81. for item in incomingQuestionModel.content!.list!{
  82.  
  83. var shouldSkipQuestion = false
  84. for sitem in sessionListModel.content!.items!{
  85. if sitem.direction! == .incoming && sitem.question?.id ?? 0 == item.id ?? 0{
  86. shouldSkipQuestion = true
  87. }
  88. }
  89.  
  90. if shouldSkipQuestion == false{
  91. // if item.active ?? false == true{
  92. _tmpArray.append(item)
  93. // }else{
  94. // _tmpInactArray.append(item)
  95. // }
  96.  
  97. if item.unreadCount ?? 0 > 0{
  98. incomingUnreadedTotal = incomingUnreadedTotal + ( item.unreadCount ?? 0)
  99. }
  100.  
  101. if item.read == false && item.sender!.userID! != AppData.sharedInstance.authModel.user!.userID! {
  102. incomingUnreadedTotal = incomingUnreadedTotal + 1
  103. }
  104.  
  105. }
  106.  
  107. }
  108.  
  109.  
  110. _tmpArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
  111. _tmpInactArray.sort{ ($0 as! DateComparable).updated() > ($1 as! DateComparable).updated() }
  112.  
  113. combinedIncomingArray = _tmpArray
  114. combinedIncomingInactiveArray = _tmpInactArray
  115. }
  116.  
  117.  
  118. updateView()
  119.  
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement