30/09/22 - 23h00
parent
5ed856e042
commit
a0623166a2
|
@ -117,7 +117,7 @@ QUERY_LIMIT_ROW = 50
|
|||
'''
|
||||
Cette variable definit le nombre max
|
||||
retour à faire sur page d'acceuil '''
|
||||
MAINPAGE_QUERY_LIMIT_ROW = 55
|
||||
MAINPAGE_QUERY_LIMIT_ROW = 4
|
||||
|
||||
|
||||
'''
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
,index,mots,occurence,moyenne,id_formation,source_field
|
||||
0,0,comprendre,1,0.33,CH_PA1201910,title
|
||||
1,1,develov,1,0.33,CH_PA1201910,title
|
||||
2,2,cherif,1,0.33,CH_PA1201910,title
|
||||
0,0,after,1,0.33,VP14120,title
|
||||
1,1,effect,1,0.33,VP14120,title
|
||||
2,2,essentiel,1,0.33,VP14120,title
|
||||
|
|
|
|
@ -1,4 +1,4 @@
|
|||
mots occurence moyenne id_formation source_field
|
||||
0 comprendre 1 0.33 CH_PA1201910 title
|
||||
1 develov 1 0.33 CH_PA1201910 title
|
||||
2 cherif 1 0.33 CH_PA1201910 title
|
||||
mots occurence moyenne id_formation source_field
|
||||
0 after 1 0.33 VP14120 title
|
||||
1 effect 1 0.33 VP14120 title
|
||||
2 essentiel 1 0.33 VP14120 title
|
|
@ -203,25 +203,24 @@ def GetStat_class_view(diction):
|
|||
|
||||
pipe2 = [
|
||||
{'$match': {'date_update' : { '$gte' : str(date_start), '$lte' : str(date_end)},
|
||||
'partner_owner_recid':str(user_recid)
|
||||
'partner_owner_recid':str(user_recid),
|
||||
}},
|
||||
{
|
||||
'$group': {
|
||||
'_id': {
|
||||
|
||||
"OWNER": "$owner",
|
||||
"Date_view": {"$substr": ["$date_update", 0, SUBSTR]},
|
||||
"OWNER": "$partner_owner_recid",
|
||||
},
|
||||
'count': {'$count': {}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$sort": {"count": -1}
|
||||
"$sort": {"_id": 1}
|
||||
}
|
||||
]
|
||||
|
||||
#print(" PIP 2 ="+str(pipe2))
|
||||
print(" PIP 21 ="+str(pipe2))
|
||||
|
||||
insertObject = []
|
||||
for result in collection.aggregate(pipe2):
|
||||
|
@ -326,7 +325,6 @@ def GetStat_class_view_topX(diction):
|
|||
local_status, try_end_date = mycommon.TryToDateYYYMMDD(str(diction['date_end']))
|
||||
new_end_date = try_end_date.date()
|
||||
|
||||
|
||||
local_status, try_from_date = mycommon.TryToDateYYYMMDD(str(diction['date_start']))
|
||||
new_from_date = try_from_date.date()
|
||||
|
||||
|
@ -335,10 +333,10 @@ def GetStat_class_view_topX(diction):
|
|||
|
||||
categories = {}
|
||||
categories_val = ""
|
||||
while ( tmp > -10 and str(day_before) != str(new_from_date) ) :
|
||||
tmp = tmp - 1
|
||||
day_before = new_end_date + timedelta(days=tmp)
|
||||
categories_val = categories_val+str(day_before)+","
|
||||
while ( tmp < 10 and str(day_before) != str(new_from_date) ) :
|
||||
day_after = new_from_date + timedelta(days=tmp)
|
||||
categories_val = categories_val+str(day_after)+","
|
||||
tmp = tmp + 1
|
||||
#print(" day_before DATE = " + str(day_before)+ " VS "+str(new_from_date))
|
||||
|
||||
if(categories_val.endswith(',') ):
|
||||
|
@ -421,8 +419,8 @@ def GetStat_class_view_topX(diction):
|
|||
'$group': {
|
||||
'_id': {
|
||||
"Date_view": {"$substr": ["$date_update", 0, SUBSTR]},
|
||||
"INTERNAL URL": "$internal_url",
|
||||
"OWNER": "$owner",
|
||||
"INTERNAL URL": "$internal_url",
|
||||
|
||||
},
|
||||
'count': {'$count': {}
|
||||
|
@ -435,7 +433,7 @@ def GetStat_class_view_topX(diction):
|
|||
|
||||
]
|
||||
|
||||
print(" PIP 2 ="+str(pipe2))
|
||||
print(" PIP 22 ="+str(pipe2))
|
||||
for result in collection.aggregate(pipe2):
|
||||
print(str(result['_id']) + " ===> " + str(result['count']))
|
||||
|
||||
|
@ -764,7 +762,7 @@ def GetStat_class_by_internal_url(diction):
|
|||
|
||||
]
|
||||
|
||||
#print(" PIP 2 ="+str(pipe2))
|
||||
#print(" PIP 23 ="+str(pipe2))
|
||||
#for result in collection.aggregate(pipe2):
|
||||
# print(str(result['_id']) + " ===> " + str(result['count']))
|
||||
|
||||
|
|
19
wrapper.py
19
wrapper.py
|
@ -183,7 +183,21 @@ def get_all_class(diction):
|
|||
|
||||
nb_formation_a_jouter = MYSY_GV.MAINPAGE_QUERY_LIMIT_ROW - len(tab_training_inzone)
|
||||
|
||||
#print(" #### get_all_class : nb_formation_a_jouter "+str(nb_formation_a_jouter)+" "
|
||||
# "MYSY_GV.MAINPAGE_QUERY_LIMIT_ROW = "+str(MYSY_GV.MAINPAGE_QUERY_LIMIT_ROW)+" len(tab_training_inzone) = "+
|
||||
# str(len(tab_training_inzone) ))
|
||||
|
||||
|
||||
"""
|
||||
Travail à faire :
|
||||
le bug actuel vient du fait que la 2ieme requete ci-dessous qui complete la liste des formation
|
||||
ajoute les formations deja trouvée dans la requete d'en haute.
|
||||
|
||||
A faire : faire en sorte que la requete d'en dessous exclus les elements deja trouvée dans lreque en dessus.
|
||||
|
||||
|
||||
"""
|
||||
sdsqqs
|
||||
coll_name = MYSY_GV.dbname['myclass']
|
||||
|
||||
val_tmp = len(tab_training_inzone)
|
||||
|
@ -305,7 +319,9 @@ def get_training_in_user_zone(diction):
|
|||
coll_name = MYSY_GV.dbname['myclass']
|
||||
val_tmp = 1
|
||||
insertObject = []
|
||||
print(" critère de recherche : user_country_code = "+str(mydata['user_country_code']).lower()+" ---- user_city = "+str(mydata['user_city']).lower())
|
||||
|
||||
|
||||
print(" ########## critère de recherche : user_country_code = "+str(mydata['user_country_code']).lower()+" ---- user_city = "+str(mydata['user_city']).lower())
|
||||
for x in coll_name.find({ "$or": [ {'valide':'1', 'locked':'0', 'isalaune':'1','published':'1', "zone_diffusion.country":str(mydata['user_country_code']).lower()},
|
||||
{'valide':'1', 'locked':'0', 'isalaune':'1', 'published':'1', "zone_diffusion.city":str(mydata['user_city']).lower()} ] },
|
||||
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
|
||||
|
@ -328,6 +344,7 @@ def get_training_in_user_zone(diction):
|
|||
|
||||
user = x
|
||||
user['id'] = str(val_tmp)
|
||||
print(" dans:get_training_in_user_zone return user = "+str(user['title']))
|
||||
insertObject.append(JSONEncoder().encode(user))
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue