Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Archive
Alchemy Viewer
Commits
cf590645
Commit
cf590645
authored
5 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix experience log depending on brain dead sorted LLSD map behavior
parent
c6d2c831
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/newview/llexperiencelog.cpp
+18
-20
18 additions, 20 deletions
indra/newview/llexperiencelog.cpp
indra/newview/llexperiencelog.h
+2
-2
2 additions, 2 deletions
indra/newview/llexperiencelog.h
indra/newview/llpanelexperiencelog.cpp
+45
-49
45 additions, 49 deletions
indra/newview/llpanelexperiencelog.cpp
with
65 additions
and
71 deletions
indra/newview/llexperiencelog.cpp
+
18
−
20
View file @
cf590645
...
@@ -90,7 +90,8 @@ void LLExperienceLog::handleExperienceMessage(LLSD& message)
...
@@ -90,7 +90,8 @@ void LLExperienceLog::handleExperienceMessage(LLSD& message)
std
::
string
day
=
daybuf
;
std
::
string
day
=
daybuf
;
if
(
!
mEvents
.
has
(
day
))
auto
iter
=
mEvents
.
find
(
day
);
if
(
iter
==
mEvents
.
end
())
{
{
mEvents
[
day
]
=
LLSD
::
emptyArray
();
mEvents
[
day
]
=
LLSD
::
emptyArray
();
}
}
...
@@ -178,7 +179,12 @@ void LLExperienceLog::saveEvents()
...
@@ -178,7 +179,12 @@ void LLExperienceLog::saveEvents()
{
{
eraseExpired
();
eraseExpired
();
std
::
string
filename
=
getFilename
();
std
::
string
filename
=
getFilename
();
LLSD
settings
=
LLSD
::
emptyMap
().
with
(
"Events"
,
mEvents
);
LLSD
temp_events
;
for
(
const
auto
&
event_pair
:
mEvents
)
{
temp_events
[
event_pair
.
first
]
=
event_pair
.
second
;
}
LLSD
settings
=
LLSD
::
emptyMap
().
with
(
"Events"
,
temp_events
);
settings
[
"MaxDays"
]
=
(
int
)
mMaxDays
;
settings
[
"MaxDays"
]
=
(
int
)
mMaxDays
;
settings
[
"Notify"
]
=
mNotifyNewEvent
;
settings
[
"Notify"
]
=
mNotifyNewEvent
;
...
@@ -212,7 +218,11 @@ void LLExperienceLog::loadEvents()
...
@@ -212,7 +218,11 @@ void LLExperienceLog::loadEvents()
mEvents
.
clear
();
mEvents
.
clear
();
if
(
mMaxDays
>
0
&&
settings
.
has
(
"Events"
))
if
(
mMaxDays
>
0
&&
settings
.
has
(
"Events"
))
{
{
mEvents
=
settings
[
"Events"
];
const
auto
&
events
=
settings
[
"Events"
];
for
(
auto
iter
=
events
.
beginMap
(),
end
=
events
.
endMap
();
iter
!=
end
;
++
iter
)
{
mEvents
[
iter
->
first
]
=
iter
->
second
;
}
}
}
eraseExpired
();
eraseExpired
();
...
@@ -225,21 +235,14 @@ LLExperienceLog::~LLExperienceLog()
...
@@ -225,21 +235,14 @@ LLExperienceLog::~LLExperienceLog()
void
LLExperienceLog
::
eraseExpired
()
void
LLExperienceLog
::
eraseExpired
()
{
{
std
::
vector
<
std
::
string
>
expired
;
for
(
auto
it
=
mEvents
.
begin
(),
end
=
mEvents
.
end
();
it
!=
end
;)
std
::
for_each
(
mEvents
.
beginMap
(),
mEvents
.
endMap
(),
[
&
](
const
auto
&
event_pair
)
{
{
const
std
::
string
&
date
=
event_pair
.
first
;
auto
event_it
=
it
++
;
if
(
isExpired
(
date
))
if
(
isExpired
(
event_it
->
first
))
{
{
expired
.
push_back
(
date
);
mEvents
.
erase
(
event_it
);
}
}
});
}
for
(
const
auto
&
date
:
expired
)
{
mEvents
.
erase
(
date
);
}
}
}
bool
LLExperienceLog
::
isExpired
(
const
std
::
string
&
date
)
bool
LLExperienceLog
::
isExpired
(
const
std
::
string
&
date
)
...
@@ -256,11 +259,6 @@ bool LLExperienceLog::isExpired(const std::string& date)
...
@@ -256,11 +259,6 @@ bool LLExperienceLog::isExpired(const std::string& date)
return
event_date
.
secondsSinceEpoch
()
<=
(
LLDate
::
now
().
secondsSinceEpoch
()
-
F64
(
getMaxDays
()
*
86400U
));
return
event_date
.
secondsSinceEpoch
()
<=
(
LLDate
::
now
().
secondsSinceEpoch
()
-
F64
(
getMaxDays
()
*
86400U
));
}
}
const
LLSD
&
LLExperienceLog
::
getEvents
()
const
{
return
mEvents
;
}
void
LLExperienceLog
::
clear
()
void
LLExperienceLog
::
clear
()
{
{
mEvents
.
clear
();
mEvents
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llexperiencelog.h
+
2
−
2
View file @
cf590645
...
@@ -50,7 +50,7 @@ public:
...
@@ -50,7 +50,7 @@ public:
U32
getPageSize
()
const
{
return
mPageSize
;
}
U32
getPageSize
()
const
{
return
mPageSize
;
}
void
setPageSize
(
U32
val
)
{
mPageSize
=
val
;
}
void
setPageSize
(
U32
val
)
{
mPageSize
=
val
;
}
const
LLSD
&
getEvents
()
const
;
const
auto
&
getEvents
()
const
{
return
mEvents
;
}
;
void
clear
();
void
clear
();
virtual
~
LLExperienceLog
();
virtual
~
LLExperienceLog
();
...
@@ -67,7 +67,7 @@ protected:
...
@@ -67,7 +67,7 @@ protected:
void
saveEvents
();
void
saveEvents
();
void
eraseExpired
();
void
eraseExpired
();
LLSD
mEvents
;
std
::
map
<
std
::
string
,
LLSD
>
mEvents
;
callback_signal_t
mSignals
;
callback_signal_t
mSignals
;
callback_connection_t
mNotifyConnection
;
callback_connection_t
mNotifyConnection
;
U32
mMaxDays
;
U32
mMaxDays
;
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llpanelexperiencelog.cpp
+
45
−
49
View file @
cf590645
...
@@ -94,9 +94,9 @@ void LLPanelExperienceLog::refresh()
...
@@ -94,9 +94,9 @@ void LLPanelExperienceLog::refresh()
{
{
S32
selected
=
mEventList
->
getFirstSelectedIndex
();
S32
selected
=
mEventList
->
getFirstSelectedIndex
();
mEventList
->
deleteAllItems
();
mEventList
->
deleteAllItems
();
const
LLSD
events
=
LLExperienceLog
::
instance
().
getEvents
();
const
auto
&
events
=
LLExperienceLog
::
instance
().
getEvents
();
if
(
events
.
size
()
==
0
)
if
(
events
.
empty
()
)
{
{
mEventList
->
setCommentText
(
getString
(
"no_events"
));
mEventList
->
setCommentText
(
getString
(
"no_events"
));
return
;
return
;
...
@@ -112,62 +112,58 @@ void LLPanelExperienceLog::refresh()
...
@@ -112,62 +112,58 @@ void LLPanelExperienceLog::refresh()
U32
items
=
0
;
U32
items
=
0
;
bool
moreItems
=
false
;
bool
moreItems
=
false
;
if
(
!
events
.
emptyMap
()
)
for
(
auto
day
=
events
.
crbegin
(),
end_day
=
events
.
crend
();
day
!=
end_day
;
++
day
)
{
{
LLSD
::
map_const_iterator
da
y
=
events
.
endMap
()
;
const
std
::
string
da
te
=
day
->
first
;
do
if
(
LLExperienceLog
::
instance
().
isExpired
(
date
))
{
{
--
day
;
continue
;
const
std
::
string
&
date
=
day
->
first
;
}
if
(
LLExperienceLog
::
instance
().
isExpired
(
date
))
const
LLSD
&
dayArray
=
day
->
second
;
{
int
size
=
dayArray
.
size
();
continue
;
if
(
itemsToSkip
>
size
)
}
{
const
LLSD
&
dayArray
=
day
->
second
;
itemsToSkip
-=
size
;
int
size
=
dayArray
.
size
();
continue
;
if
(
itemsToSkip
>
size
)
}
{
if
(
items
>=
mPageSize
&&
size
>
0
)
itemsToSkip
-=
size
;
{
continue
;
moreItems
=
true
;
}
break
;
if
(
items
>=
mPageSize
&&
size
>
0
)
}
for
(
int
i
=
dayArray
.
size
()
-
itemsToSkip
-
1
;
i
>=
0
;
i
--
)
{
if
(
items
>=
mPageSize
)
{
{
moreItems
=
true
;
moreItems
=
true
;
break
;
break
;
}
}
for
(
int
i
=
dayArray
.
size
()
-
itemsToSkip
-
1
;
i
>=
0
;
i
--
)
const
LLSD
event
=
dayArray
[
i
];
LLUUID
id
=
event
[
LLExperienceCache
::
EXPERIENCE_ID
].
asUUID
();
const
LLSD
&
experience
=
LLExperienceCache
::
instance
().
get
(
id
);
if
(
experience
.
isUndefined
())
{
waiting
=
true
;
waiting_id
=
id
;
}
if
(
!
waiting
)
{
{
if
(
items
>=
mPageSize
)
item
[
"id"
]
=
event
;
{
moreItems
=
true
;
LLSD
&
columns
=
item
[
"columns"
];
break
;
columns
[
0
][
"column"
]
=
"time"
;
}
columns
[
0
][
"value"
]
=
day
->
first
+
event
[
"Time"
].
asString
();
const
LLSD
event
=
dayArray
[
i
];
columns
[
1
][
"column"
]
=
"event"
;
LLUUID
id
=
event
[
LLExperienceCache
::
EXPERIENCE_ID
].
asUUID
();
columns
[
1
][
"value"
]
=
LLExperienceLog
::
getPermissionString
(
event
,
"ExperiencePermissionShort"
);
const
LLSD
&
experience
=
LLExperienceCache
::
instance
().
get
(
id
);
columns
[
2
][
"column"
]
=
"experience_name"
;
if
(
experience
.
isUndefined
()){
columns
[
2
][
"value"
]
=
experience
[
LLExperienceCache
::
NAME
].
asString
();
waiting
=
true
;
columns
[
3
][
"column"
]
=
"object_name"
;
waiting_id
=
id
;
columns
[
3
][
"value"
]
=
event
[
"ObjectName"
].
asString
();
}
mEventList
->
addElement
(
item
);
if
(
!
waiting
)
{
item
[
"id"
]
=
event
;
LLSD
&
columns
=
item
[
"columns"
];
columns
[
0
][
"column"
]
=
"time"
;
columns
[
0
][
"value"
]
=
day
->
first
+
event
[
"Time"
].
asString
();
columns
[
1
][
"column"
]
=
"event"
;
columns
[
1
][
"value"
]
=
LLExperienceLog
::
getPermissionString
(
event
,
"ExperiencePermissionShort"
);
columns
[
2
][
"column"
]
=
"experience_name"
;
columns
[
2
][
"value"
]
=
experience
[
LLExperienceCache
::
NAME
].
asString
();
columns
[
3
][
"column"
]
=
"object_name"
;
columns
[
3
][
"value"
]
=
event
[
"ObjectName"
].
asString
();
mEventList
->
addElement
(
item
);
}
++
items
;
}
}
}
while
(
day
!=
events
.
beginMap
());
++
items
;
}
}
}
if
(
waiting
)
if
(
waiting
)
{
{
mEventList
->
deleteAllItems
();
mEventList
->
deleteAllItems
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment